react-native: error: Duplicate file. Original is here. The version qualifier may be implied. With gradle assembleRelease
- I have reviewed the documentation
- I have searched existing issues
- I am using the latest React Native version
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 9.11.1 Yarn: 1.5.1 npm: 5.6.0 Watchman: 4.9.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 3.1 AI-173.4720617
Packages: (wanted => installed) react: ^16.3.0-alpha.1 => 16.3.2 react-native: 0.54.4 => 0.54.4
Steps to Reproduce
$ cd android && ./gradlew assembleRelease
Expected Behavior
A generated apk at the end.
Actual Behavior
Configure project :app WARNING: The option ‘android.enableAapt2’ is deprecated and should not be used anymore. Use ‘android.enableAapt2=true’ to remove this warning. It will be removed at the end of 2018… NDK is missing a “platforms” directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /Users/callsoft/Library/Android/sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove “buildToolsVersion ‘26.0.2’” from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debu g, src/nullnullDebug] registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease] registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Configure project :react-native-firebase WARNING: The option ‘android.enableAapt2’ is deprecated and should not be used anymore. Use ‘android.enableAapt2=true’ to remove this warning. It will be removed at the end of 2018… NDK is missing a “platforms” directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /Users/callsoft/Library/Android/sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
Configure project :react-native-image-picker WARNING: The option ‘android.enableAapt2’ is deprecated and should not be used anymore. Use ‘android.enableAapt2=true’ to remove this warning. It will be removed at the end of 2018… NDK is missing a “platforms” directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /Users/callsoft/Library/Android/sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: Configuration ‘testCompile’ is obsolete and has been replaced with ‘testImplementation’ and ‘testApi’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: Configuration ‘testApi’ is obsolete and has been replaced with ‘testImplementation’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove “buildToolsVersion ‘25.0.2’” from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Configure project :react-native-image-resizer WARNING: The option ‘android.enableAapt2’ is deprecated and should not be used anymore. Use ‘android.enableAapt2=true’ to remove this warning. It will be removed at the end of 2018… NDK is missing a “platforms” directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /Users/callsoft/Library/Android/sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove “buildToolsVersion ‘23.0.1’” from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Configure project :react-native-vector-icons WARNING: The option ‘android.enableAapt2’ is deprecated and should not be used anymore. Use ‘android.enableAapt2=true’ to remove this warning. It will be removed at the end of 2018… NDK is missing a “platforms” directory. If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /Users/callsoft/Library/Android/sdk/ndk-bundle. If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
WARNING: Configuration ‘compile’ is obsolete and has been replaced with ‘implementation’ and ‘api’. It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.2. Android SDK Build Tools 27.0.3 will be used. To suppress this warning, remove “buildToolsVersion ‘26.0.1’” from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :app:processReleaseGoogleServices Parsing json file: /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/google-services.json
Task :app:bundleReleaseJsAndAssets Scanning folders for symlinks in /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/node_modules (11ms) Scanning folders for symlinks in /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/no de_modules (22ms) Loading dependency graph, done. warning: the transform cache was reset. bundle: Writing bundle output to: /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/a ndroid/app/build/intermediates/assets/release/index.android.bundle bundle: Done writing bundle output bundle: Copying 18 asset files bundle: Done copying assets
/Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/res /merged/release/drawable-hdpi-v4/node_modules_reactnavigation_src_views_assets_backicon.png: error: Duplicate file. /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/res/merged/release/drawable-hdpi/node_modules_reactnavigation_src_views_assets_backicon.png: Original is here. The version qualifier may be implied.
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:app:processReleaseResources’.
Failed to process resources, see aapt output above for details.
-
Try: Run with --info or --debug option to get more log output. Run with --scan to get full insights.
-
Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:app:processReleaseResources’. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.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:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) Caused by: org.gradle.tooling.BuildException: Failed to process resources, see aapt output above for details. at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:512) at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.doFullTaskAction(LinkApplicationAndroidResourcesTask.java:249) at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:106) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92) … 29 more Caused by: com.android.ide.common.process.ProcessException: Failed to execute aapt at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:809) at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:797) at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:491) … 42 more Caused by: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process /Users/callsoft/Library/Android/sdk/build-tools/27.0.3/aapt with arguments {package -f --no-crunch -I /Users/callsoft/Library/Android/sdk/platforms/android-26/android.jar -M /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml -S/Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/res/merged/release -m -J /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/generated/source/r/release -F /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/res/release/resources-release.ap_ --custom-package com.cyndyporter -0 apk --output-text-symbols /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/symbols/release --no-version-vectors} at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:503) at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:482) at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:79) at com.android.builder.internal.aapt.AbstractAapt.link(AbstractAapt.java:34) at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:807) … 44 more Caused by: com.android.ide.common.process.ProcessException: Error while executing process /Users/callsoft/Library/Android/sdk/build-tools/27.0.3/aapt with arguments {package -f --no-crunch -I /Users/callsoft/Library/Android/sdk/platforms/android-26/android.jar -M /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/manifests/full/release/AndroidManifest.xml -S /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/res/merged/release -m -J /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/generated/source/r/release -F /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/res/release/resources-release.ap_ --custom-package com.cyndyporter -0 apk --output-text-symbols /Users/callsoft/Documents/Mobulous/Projects/React/cyndy-porter-style-photography/android/app/build/intermediates/symbols/release --no-version-vectors} at com.android.build.gradle.internal.process.GradleProcessResult.buildProcessException(GradleProcessResult.java:73) at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:48) at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:78) at com.android.builder.internal.aapt.AbstractProcessExecutionAapt$1.onSuccess(AbstractProcessExecutionAapt.java:74) at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1237) at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399) at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:911) at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:822) at com.google.common.util.concurrent.AbstractFuture.set(AbstractFuture.java:664) at com.google.common.util.concurrent.SettableFuture.set(SettableFuture.java:48) at com.android.build.gradle.internal.process.GradleProcessExecutor$1.run(GradleProcessExecutor.java:58) Caused by: org.gradle.process.internal.ExecException: Process ‘command ‘/Users/callsoft/Library/Android/sdk/build-tools/27.0.3/aapt’’ finished with non-zero exit value 1 at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:382) at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:46) … 9 more
-
Get more help at https://help.gradle.org
BUILD FAILED in 4m 58s 62 actionable tasks: 4 executed, 58 up-to-date
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 31
- Comments: 35 (3 by maintainers)
Add the following code to file node_modules/react-native/react.gradle :
inside
def currentBundleTask = tasks.create(...
Found this temporary solution here.
Working for me.
@PierreBresson solution worked for me with RN 0.57.2 and
patch-package
Here’s thereact-native+0.57.2.patch
file if someone needs it:@PierreBresson
seems not work with 0.57.0 , work fine with 0.55 🤔
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.55?
Thank you for your contributions.
I’ve upgraded my react native to 57.7 react to 16.3.2 build tools gradle to 3.2.0 gradle to 4.6
rm -rf android/app/src/main/res/drawable-*
from gradle.properties remove android.enableAapt2=false
#use the following command to bundle assets:
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/
now generate release apk using following command.
cd android && ./gradlew assembleRelease && cd ..
@zszep yes @PierreBresson code solved it
Here’s how i generate signed apk for android now:
I moved image files from
drawble-mdpi
todrawable-hdpi
directory. Now it is working fine!well, i solved in this way:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
This worked for me: https://stackoverflow.com/a/48985684
@7laria’s answer worked for me. Well, part of the answer did the trick. Along with step 1 and 2, just updated
com.android.tools.build:gradle
to3.2.0
Thanks @GaneshSaiKumar !
Or alternatively delete
drawable-mdpi
folder, it works too#Follow this:- https://medium.com/@nhancv/react-native-build-release-duplicate-file-original-is-here-the-version-qualifier-may-be-implied-115e967c59e6
Right now I am on vacation. Will check it as soon as I return home.
– Voditelj Službe za informatiku KBC Osijek