-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gradlew assembleRelease failing at processReleaseResources [0.19] #5787
Comments
Hey haydenth, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
Specifically the error is
this appears to be related to some kind of android/gradle issue |
Dug more into this. Looks like the packager is generating images in both drawable-mdpi and drawable-mdpi-v4. I guess newer versions of aapt don't like this so much, even with cruncher disabled..
|
I was able to get around this by changing mdpi to mdpi-v4 in:
|
Hi @haydenth, can't reproduce this in a new app. |
I think
Or let these folder name can be configured in gradle script. Because the newest android gradle plugin force to added v4 suffix to the drawable folders by default when execute |
I have customized
|
Had The same issue still not resolved. |
Solved by deleting the file |
@RonakKhandelwal hi can you please help me i am getting same error "Execution failed for task ':processReleaseResources'."... thanks |
@PunitSaharan can you please post the terminal output in my case the output simply said unknown source file duplicate file so I'm not sure if you have the same problem |
Hey, sorry for delayed response. I can't replicate from a fresh install, so I'm thinking it probably has something to do with coming from an older version (my project started way back in the react-native 0.12 days). So I am guessing this bug is related to some older files existing that need to be truncated as mentioned above. Given that I went from a fresh install and don't have this problem anymore, not sure this is a bug. |
I had the same issue, and changing |
I'm having the same issue on |
This file names seems weird... is this supposed to be named like this? Seems like it should be By the way I'm not using |
I ran it by running a "find" command in the terminal with the filename, then running rm on the matched file and it fixed it. |
@Naoto-Ida I have the same issue except for mdpi. You figure anything out yet? I'll post if I do. |
@SDB9 I think I just manually deleted those images in the end |
@haydenth I found the root cause is that old version's packager collect resources (image etc.) and put under |
@chamchamgo That solved my problem for good. Thank you so much. Closing this ticket out, don't think any further work needed here. |
@haydenth could you reopen? I put images which I use in native code to drawable folders. I can't just remove them. This issue is still relevant for me. |
Also I don't need NavigationExperimental assets in my apk |
I hate to be pedantic, but could you open a different issue for that? I think it's similar but not quite the same issue I was handling. |
This is still not fixed for me either, the only thing that works reliably is changing |
In my case, it was just a matter of removing the |
I know this issue is closed. But if you are developing React Native in an Android Library, then you will still have this issue as the newer version of Gradle forces library artifacts to resolve their images to a v4 drawable suffix. I'm currently working on a fix that I will submit a PR for that specific use case. |
@ledfusion
its solves my problem, but every time I was forced do delete drawable and cd android && ./gradlew clean && ./gradlew assembleRelease even this is (react-native run-android --configuration=release) also gives same error. _
_ |
facebook#5787 Original is here. The version qualifier may be implied
facebook#5787 Error : Original is here. The version qualifier may be implied
@AvatarQing Thank you so much! |
+1 |
Happened to me again today. @AvatarQing's fix solved this |
i am also faced same kind of issue.its may help u Unknown source file : res/drawable-mdpi-v4/images_tobacco.png:0: error: Resource entry images_tobacco is already defined. **What went wrong:
i just changed image extension(jpg to png) in drawable-mdpi-v4 folder. |
I figured the issue was bundling assets based on @chamchamgo 's comment
Note the updated
|
I still have this problem with react-native 0.54.0 |
CAUTION please consider your **react native version ** and android sdk version🔥🔥🔥
after reading this first delete drawble files first changing file node_modules/react-native/react.gradle adding
to currentBundleTask and adding android.enableAapt2=false to gradle.propertise hope solution help RN Developers. |
Changing things within node_modules isn't really an effective solution. Just deleting |
@naoey's solution worked for me + changing the app level build.gradle file to
|
…ies) Summary: _Quick apologies for the lengthiness of this description. Want to make sure I'm clear and it is understood what is being altered._ Thanks for submitting a PR! Please read these instructions carefully: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. #5787 ``` Unknown source file : /home/tom/projects/blueprint-native/android/app/build/intermediates/res/merged/release/drawable-mdpi-v4/images_google.png: error: Duplicate file. Unknown source file : /home/tom/projects/blueprint-native/android/app/build/intermediates/res/merged/release/drawable-mdpi/images_google.png: Original is here. The version qualifier may be implied. ``` At Hudl, we've been attempting to package our React Native code into Library Dependencies _(Cocoapods / Android Artifact Resource (aar))_. Recently in React Native 0.42.0, there was an upgrade to the Android Project's gradle plugin from 1.3.1 to 2.2.3. This update drastically effected the outcome of drawable resources in Android without anyone noticing. **There are 4 outcomes to consider with this change:** 1. You are developing in an Android Application using Gradle 1.3.1 or lower 2. You are developing in an Android Application using Gradle 2.2.3 or higher 3. You are developing in an Android Library Module using Gradle 1.3.1 or lower 4. You are developing in an Android Library Module using Gradle 2.2.3 or higher With the upgrade to 2.2.3, Android changed the way aapt builds its resources. Any Library created with 2.2.3, has its resources ending with a `v4` suffix. The reasoning behind this I'm not sure of but assume it deals with Vector support that was added around that time. The change I've added checks if React Native is being ran in an Android Library vs an Application, and appends the v4 suffix to the merged asset folders. Multiple test were performed. 1. I first started out validating my assumption about the asset merger by creating a new Android Project to verify my assumptions above. 1. [Application + >= 2.2.3](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/master/app/build/intermediates/res/merged/debug) -- `hdpi` contains my drawable. `hdpi-v4` contains dependency's drawables. 2. [Application + <= 1.3.1](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/Android-LegacyVersion/app/build/intermediates/res/merged/debug) -- Same as above (I expect because deps are compiled against gradle 2.2.3+ themselves. 3. [Library + >= 2.2.3](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/Android-UsingAndroidLibrary/library/build/intermediates/res/merged/debug) -- Only `-v4` folders found! Resources from the library are packages in the app's build output in similar `-v4` folder too. 4. [Library + <= 1.3.1](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/Android-UsingAndroidLibraryLegacyVersion/library/build/intermediates/res/merged/debug) -- Same as ii. & iii. `-v4` contains other resources, but my resources are located in non -v4 folder. 2. I then wanted to validate against React Native itself. So I updated my react native code using this PR/Branch, and tested against my project locally. Unfortunately I cannot share that code as it is private, but before this change I was getting the same error as mentioned in #5787 and now my build runs as intended with the assets being placed where they should be. Additional resources: * #5787 * http://stackoverflow.com/questions/35700272/android-build-tool-adds-v4-qualifier-to-drawable-folders-by-default-in-generated * #12710 Please let me know if more information is needed, further test plans, etc. With this change we should be able to upgrade to Gradle 2.3.0 as well to support the latest version of Android Studio. Closes #13128 Differential Revision: D7828618 Pulled By: hramos fbshipit-source-id: a7ad7b63b1b51cbfd2ea7656e4d77321306ce33a
Here's another workaround which i have used. react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res and then use android studio generate apk options . |
The fix for library based android projects has been merged so we'll hopefully see it in a future release too 2d9e2f3 |
After trying immense amount of workarounds; we ended up downgrading gradle version to 2.2.3 from 3.0.1 now it works fine. |
I still had this error with Gradle 3.0.1 :/ Trying so many things that I don't remember them anymore :D |
…ies) Summary: _Quick apologies for the lengthiness of this description. Want to make sure I'm clear and it is understood what is being altered._ Thanks for submitting a PR! Please read these instructions carefully: - [x] Explain the **motivation** for making this change. - [x] Provide a **test plan** demonstrating that the code is solid. - [x] Match the **code formatting** of the rest of the codebase. - [x] Target the `master` branch, NOT a "stable" branch. facebook#5787 ``` Unknown source file : /home/tom/projects/blueprint-native/android/app/build/intermediates/res/merged/release/drawable-mdpi-v4/images_google.png: error: Duplicate file. Unknown source file : /home/tom/projects/blueprint-native/android/app/build/intermediates/res/merged/release/drawable-mdpi/images_google.png: Original is here. The version qualifier may be implied. ``` At Hudl, we've been attempting to package our React Native code into Library Dependencies _(Cocoapods / Android Artifact Resource (aar))_. Recently in React Native 0.42.0, there was an upgrade to the Android Project's gradle plugin from 1.3.1 to 2.2.3. This update drastically effected the outcome of drawable resources in Android without anyone noticing. **There are 4 outcomes to consider with this change:** 1. You are developing in an Android Application using Gradle 1.3.1 or lower 2. You are developing in an Android Application using Gradle 2.2.3 or higher 3. You are developing in an Android Library Module using Gradle 1.3.1 or lower 4. You are developing in an Android Library Module using Gradle 2.2.3 or higher With the upgrade to 2.2.3, Android changed the way aapt builds its resources. Any Library created with 2.2.3, has its resources ending with a `v4` suffix. The reasoning behind this I'm not sure of but assume it deals with Vector support that was added around that time. The change I've added checks if React Native is being ran in an Android Library vs an Application, and appends the v4 suffix to the merged asset folders. Multiple test were performed. 1. I first started out validating my assumption about the asset merger by creating a new Android Project to verify my assumptions above. 1. [Application + >= 2.2.3](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/master/app/build/intermediates/res/merged/debug) -- `hdpi` contains my drawable. `hdpi-v4` contains dependency's drawables. 2. [Application + <= 1.3.1](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/Android-LegacyVersion/app/build/intermediates/res/merged/debug) -- Same as above (I expect because deps are compiled against gradle 2.2.3+ themselves. 3. [Library + >= 2.2.3](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/Android-UsingAndroidLibrary/library/build/intermediates/res/merged/debug) -- Only `-v4` folders found! Resources from the library are packages in the app's build output in similar `-v4` folder too. 4. [Library + <= 1.3.1](https://github.com/jpshelley/TestAndroidLibraryDrawables/tree/Android-UsingAndroidLibraryLegacyVersion/library/build/intermediates/res/merged/debug) -- Same as ii. & iii. `-v4` contains other resources, but my resources are located in non -v4 folder. 2. I then wanted to validate against React Native itself. So I updated my react native code using this PR/Branch, and tested against my project locally. Unfortunately I cannot share that code as it is private, but before this change I was getting the same error as mentioned in facebook#5787 and now my build runs as intended with the assets being placed where they should be. Additional resources: * facebook#5787 * http://stackoverflow.com/questions/35700272/android-build-tool-adds-v4-qualifier-to-drawable-folders-by-default-in-generated * facebook#12710 Please let me know if more information is needed, further test plans, etc. With this change we should be able to upgrade to Gradle 2.3.0 as well to support the latest version of Android Studio. Closes facebook#13128 Differential Revision: D7828618 Pulled By: hramos fbshipit-source-id: a7ad7b63b1b51cbfd2ea7656e4d77321306ce33a
Just running a stock
Getting a failure at processReleaseResources. Not really sure what to do, this looks like it has something to do with aapt and the android packager but I don't know and some basic searches revealing nothing interesting. Any ideas? Is there just some android package I failed to install?
The text was updated successfully, but these errors were encountered: