react-native: gradlew assembleRelease failing at processReleaseResources [0.19]
Just running a stock
./gradlew assembleRelease --stacktrace
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?
bundle: Done copying assets
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processReleaseResources'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:50)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:27)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:33)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:147)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:98)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 49 more
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:42)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:919)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:138)
... 57 more
Caused by: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.2/aapt'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:40)
... 59 more
BUILD FAILED
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 16
- Comments: 51 (21 by maintainers)
Commits related to this issue
- Chagnging android suffix (https://github.com/facebook/react-native/issues/5787) — committed to KocomojoLLC/react-native by ewindso 7 years ago
- bug fix res/drawable https://github.com/facebook/react-native/issues/5787 Original is here. The version qualifier may be implied — committed to transindia/react-native by iiitmahesh 7 years ago
- bug fix res/drawable https://github.com/facebook/react-native/issues/5787 Error : Original is here. The version qualifier may be implied — committed to transindia/react-native by iiitmahesh 7 years ago
- Android - Fix Drawable v4 paths in Android Artifact Resources (Libraries) Summary: _Quick apologies for the lengthiness of this description. Want to make sure I'm clear and it is understood what is b... — committed to facebook/react-native by jpshelley 6 years ago
- Android - Fix Drawable v4 paths in Android Artifact Resources (Libraries) Summary: _Quick apologies for the lengthiness of this description. Want to make sure I'm clear and it is understood what is b... — committed to macdoum1/react-native by jpshelley 6 years ago
@haydenth I found the root cause is that old version’s packager collect resources (image etc.) and put under $(rn_project)\android\app\src\main\res, while newer version put them under $(rn_project)\android\app\build\intermediates\res\merged$(buildType). It brings duplication which leads to failure of task ‘processReleaseResources’. And it also explains why new created project works well. When you have an old RN project upgrading to newer version, just delete directories like ‘drawable-xxxx’ (ATTN:no ‘v?’ postfix) under $(rn_project)\android\app\src\main\res and wolrd will be nice.
I have customized
react.gradle
to solve the Duplicate file error perfectly. Add following code in tocurrentBundleTask
’s creation blockI was able to get around this by changing mdpi to mdpi-v4 in: node_modules/react-native/local-cli/bundle/assetPathUtils.js
I think
node_modules/react-native/local-cli/bundle/assetPathUtils.js
is need to update to this :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
processResources
task, if you do this, it will avoids potential Duplicate file error betweendrawable-xdpi-v4
anddrawable-xdpi
.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.
~/Documents/CoolApp/android/app/build/intermediates/res/merged/release/drawable-hdpi-v4/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png
this seems to be the issue… I tried all the methods above.This file names seems weird… is this supposed to be named like this? Seems like it should be
/
separated than_
.By the way I’m not using
NavigationExperimental
anywhere. It comes up in theindex.android.bundle
when grepping.In my case, it was just a matter of removing the
$(rn_project)\android\app\src\main\res\drawable-*
like suggested, then running./gradlew clean
and then trying to compile againI figured the issue was bundling assets based on @chamchamgo 's comment To resolve it, this is what I did
Note the updated
--assets-dest
in the above command. Assembling the APK worked ok after that!CAUTION please consider your **react native version ** and android sdk version🔥🔥🔥 i face this problem after three ours and see many article i finally found solution
because i using lottie animation i need buil with SDK VERSION 26
and using this structure
BACK UP YOUR RN FOLDER FIRST OF ALL
after reading this
first delete drawble files first
rm -rf android/app/src/main/res/drawable-*
changing file node_modules/react-native/react.gradle adding
to currentBundleTask and adding android.enableAapt2=false to gradle.propertise finally commnad ./gradlew assembleRelease worked !!! NO Need to change assetPathUtil it’s bug of gradle to renaming picture
hope solution help RN Developers.
I still have this problem with react-native 0.54.0
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.
Tried all of the above with no luck on a project that started out on RN 0.11 and is now on 0.33. What finally worked was to match the Gradle and Android plugin versions in our project with those from a pristine RN project.
Changes included:
${project_dir}/android/app/build.gradle
${project_dir}/android/gradle/wrapper/gradle-wrapper.properties
I think In my case, Android Studio altered these values when it detected newer versions of Gradle and the Android plugin for Gradle.
@naoey’s solution worked for me + changing the app level build.gradle file to
Changing things within node_modules isn’t really an effective solution. Just deleting
drawable-*
and disabling aapt2 has fixed it for now.I still had this error with Gradle 3.0.1 😕 Trying so many things that I don’t remember them anymore 😄
@AvatarQing 's solution is the only thing that worked for me, sadly. This bothers me a lot since I really don’t want to change react-native inside
node_modules
…Had The same issue still not resolved.
Both solutions from @hmedney and @AvatarQing worked for me. I had upgraded my gradle because i am using react-native-google-signin, and its docs asked me to upgrade gradle. But then, I ran into this issue. It turns out I don’t really have to upgrade gradle for the google signin stuff, so I just reverted back to the stock versions specified by react-native.
There is no need to remove drawable-xxxx folders just.
git clean -f -d
on jenkins ci solved problem for me.I ran it by running a “find” command in the terminal with the filename, then running rm <path> on the matched file and it fixed it.