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
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.
react-native
or for more real time interactions, ask on Discord in the #react-native channel.Specifically the error is
Skipping task ':app:processReleaseManifest' as it is up-to-date (took 0.011 secs).
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseManifest (Thread[main,5,main]) completed. Took 0.015 secs.
:app:processReleaseResources (Thread[main,5,main]) started.
:app:processReleaseResources
Executing task ':app:processReleaseResources' (up-to-date check took 0.046 secs) due to:
No history is available.
All input files are considered out-of-date for incremental task ':app:processReleaseResources'.
Starting process 'command '/usr/local/opt/android-sdk/build-tools/23.0.2/aapt''. Working directory: /Users/tom/projects/blueprint-native/android/app Command: /usr/local/opt/android-sdk/build-tools/23.0.2/aapt package -f --no-crunch -I /usr/local/opt/android-sdk/platforms/android-23/android.jar -M /Users/tom/projects/blueprint-native/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml -S /Users/tom/projects/blueprint-native/android/app/build/intermediates/res/merged/release -A /Users/tom/projects/blueprint-native/android/app/build/intermediates/assets/release -m -J /Users/tom/projects/blueprint-native/android/app/build/generated/source/r/release -F /Users/tom/projects/blueprint-native/android/app/build/intermediates/res/resources-release.ap_ -G /Users/tom/projects/blueprint-native/android/app/build/intermediates/proguard-rules/release/aapt_rules.txt --custom-package com.blueprintnative -0 apk --output-text-symbols /Users/tom/projects/blueprint-native/android/app/build/intermediates/symbols/release
Successfully started process 'command '/usr/local/opt/android-sdk/build-tools/23.0.2/aapt''
Unknown source file : /Users/tom/projects/blueprint-native/android/app/build/intermediates/res/merged/release/drawable-mdpi-v4/images_back.png: error: Duplicate file.
Unknown source file : /Users/tom/projects/blueprint-native/android/app/build/intermediates/res/merged/release/drawable-mdpi/images_back.png: Original is here. The version qualifier may be implied.
:app:processReleaseResources FAILED
:app:processReleaseResources (Thread[main,5,main]) completed. Took 0.257 secs.
this appears to be related to some kind of android/gradle issue
http://stackoverflow.com/questions/29965398/gradle-finished-with-non-zero-exit-value-1-ic-launcher-png-error-duplicate-fi
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..
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.
I was able to get around this by changing mdpi to mdpi-v4 in:
node_modules/react-native/local-cli/bundle/assetPathUtils.js
function getAndroidAssetSuffix(scale) {
switch (scale) {
case 0.75: return 'ldpi';
case 1: return 'mdpi-v4';
case 1.5: return 'hdpi';
case 2: return 'xhdpi';
case 3: return 'xxhdpi';
case 4: return 'xxxhdpi';
}
}
Hi @haydenth, can't reproduce this in a new app.
Can you create a fresh example?
I think node_modules/react-native/local-cli/bundle/assetPathUtils.js
is need to update to this :
function getAndroidAssetSuffix(scale) {
switch (scale) {
case 0.75: return 'ldpi-v4';
case 1: return 'mdpi-v4';
case 1.5: return 'hdpi-v4';
case 2: return 'xhdpi-v4';
case 3: return 'xxhdpi-v4';
case 4: return 'xxxhdpi-v4';
}
}
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 between drawable-xdpi-v4
and drawable-xdpi
.
I have customized react.gradle
to solve the Duplicate file error perfectly. Add following code in to currentBundleTask
's creation block
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("${resourcesDir}/drawable-${resSuffix}")
if (originalDir.exists()) {
File destDir = file("${resourcesDir}/drawable-${resSuffix}-v4")
ant.move(file: originalDir, tofile: destDir)
}
}
moveFunc.curry("ldpi").call()
moveFunc.curry("mdpi").call()
moveFunc.curry("hdpi").call()
moveFunc.curry("xhdpi").call()
moveFunc.curry("xxhdpi").call()
moveFunc.curry("xxxhdpi").call()
}
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 node_modules/react-native/local-cli/bundle/assetPathUtils.js
as @haydenth did solved it for me. Is there any drawbacks to this? Should we merge it in?
I'm having the same issue on 0.25.1
. Anyway to fix this?
~/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 the index.android.bundle
when grepping.
I ran it by running a "find" command in the terminal with the filename, then running rm
@Naoto-Ida I have the same issue except for mdpi. You figure anything out yet? I'll post if I do.
/android/app/build/intermediates/res/merged/release/drawable-mdpi/node_modules_reactnativerouterflux_node_modules_reactnativeexperimentalnavigation_assets_backicon.png
@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 $(rn_project)androidappsrcmainres, while newer version put them under $(rn_project)androidappbuildintermediatesresmerged$(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锛歯o 'v?' postfix) under $(rn_project)androidappsrcmainres and wolrd will be nice.
@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 node_modules/react-native/local-cli/bundle/assetPathUtils.js
same problem
/Users/lxxyx/rn/us/android/app/build/intermediates/res/merged/release/drawable-hdpi-v4/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png: error: Duplicate file.
/Users/lxxyx/rn/us/android/app/build/intermediates/res/merged/release/drawable-hdpi/node_modules_reactnative_libraries_customcomponents_navigationexperimental_assets_backicon.png: Original is here. The version qualifier may be implied.
:app:processReleaseResources FAILED
:app:processReleaseResources (Thread[main,5,main]) completed. Took 0.04 secs.
FAILURE: Build failed with an exception.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/lxxyx/Library/Android/sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
- Try:
Run with --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:66)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
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.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:153)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:150)
at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:98)
at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:92)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:92)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:83)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:99)
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:48)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:81)
at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:46)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51)
at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43)
at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:173)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:239)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:212)
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.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:205)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
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:55)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:36)
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 '/Users/lxxyx/Library/Android/sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:207)
at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:82)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:245)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:221)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:232)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:210)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 60 more
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/lxxyx/Library/Android/sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:43)
at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:983)
at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:163)
... 68 more
Caused by: org.gradle.process.internal.ExecException: Process 'command '/Users/lxxyx/Library/Android/sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:367)
at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:41)
... 70 more
BUILD FAILED
There is no need to remove drawable-xxxx folders just. git clean -f -d
on jenkins ci solved problem for me.
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
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1
}
${project_dir}/android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
I think In my case, Android Studio altered these values when it detected newer versions of Gradle and the Android plugin for Gradle.
I have same question, it seems only run command: ./gradlew assembleRelease --info have the problem.
First build bundle use 'react-native bundle' and then use Android Studio build apk have no problem.
@sdg9 i have the same issues, how to fix it?
This is a long running issue that has already been closed once by the original author. I recommend opening a new issue if you're still running into this.
@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
...
@AvatarQing 's solution also worked for me. I'll create a new issue for this.
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.
Just an update to @hmedney's solution. Make sure you modify the file in:
${project_dir}/android/build.gradle
.
That is, not the one in android/app
Tripped over that one.
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 again
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
removing the $(rn_project)androidappsrcmainresdrawable-* like suggested, then running ./gradlew clean and then trying to compile again
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.
_
/home/mahesh/projects/gitlab/test/android/app/build/intermediates/res/merged/release/drawable-mdpi/src_images_loader.gif: error: Duplicate file.
/home/mahesh/projects/gitlab/test/android/app/build/intermediates/res/merged/release/drawable-mdpi-v4/src_images_loader.gif: 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.
Unknown source file : res/drawable-mdpi-v4/images_tobacco.jpg:0: Originally defined here.
**What went wrong:
Execution failed for task ':app:processReleaseResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/xxxx/Android/Sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1**
i just changed image extension(jpg to png) in drawable-mdpi-v4 folder.
i got error in images_tobacco.jpg file.so taht i just changed that image extension(jpg to png).now it works fine
I figured the issue was bundling assets based on @chamchamgo 's comment
To resolve it, this is what I did
rm -rf android/app/src/main/res/drawable-*
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/build/intermediates/res/merged/release/
Note the updated --assets-dest
in the above command. Assembling the APK worked ok after that!
react-native run-android --variant=release
I still have this problem with react-native 0.54.0
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
"react": "^16.3.0-alpha.1",
"native-base": "^2.3.10",
"react-native": "0.54.2",
compileSdkVersion 26
buildToolsVersion "26.0.1"
md5-418cebbd6ea5999461d14519448257b7
doLast {
def moveFunc = { resSuffix ->
File originalDir = file("${resourcesDir}/drawable-${resSuffix}")
if (originalDir.exists()) {
File destDir = file("${resourcesDir}/drawable-${resSuffix}-v4")
ant.move(file: originalDir, tofile: destDir)
}
}
moveFunc.curry("ldpi").call()
moveFunc.curry("mdpi").call()
moveFunc.curry("hdpi").call()
moveFunc.curry("xhdpi").call()
moveFunc.curry("xxhdpi").call()
moveFunc.curry("xxxhdpi").call()
}
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.
Changing things within node_modules isn't really an effective solution. Just deleting drawable-*
and disabling aapt2 has fixed it for now.
@naoey's solution worked for me + changing the app level build.gradle file to
...
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.project"
minSdkVersion 16
targetSdkVersion 22
versionCode 2
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
...
Here's another workaround which i have used.
Use this command to update jsbundle.
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 https://github.com/facebook/react-native/commit/2d9e2f30e17b8e79f2c44ef533ecdd550671304c
After trying immense amount of workarounds; we ended up downgrading gradle version to 2.2.3 from 3.0.1
and also in gradle/wrapper/gradle-wrapper.properties
distributionUrl=https://services.gradle.org/distributions/gradle-2.14.1-all.zip
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
Most helpful comment
@haydenth I found the root cause is that old version's packager collect resources (image etc.) and put under $(rn_project)androidappsrcmainres, while newer version put them under $(rn_project)androidappbuildintermediatesresmerged$(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锛歯o 'v?' postfix) under $(rn_project)androidappsrcmainres and wolrd will be nice.