-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
error: Duplicate file. Original is here. The version qualifier may be implied. With gradle assembleRelease #19211

Comments
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. |
+1, same error |

Add the following code to file node_modules/react-native/react.gradle :
inside Found this temporary solution here. |
any solution yet? |
@zszep yes Here's how i generate signed apk for android now:
|
@akamahesh This is basically a hack. Tried it. It works. But when i updated react-native to a newer version, the change was overwritten. Also, the node_modules folder is not under source control. |
@akamahesh It not works. |
@zszep Yes its a hack! |
@zszep @akamahesh You could make a patch directory in your project root where you would keep your updated version of the react.gradle file. Then in your package.json, cp the file to ./node_modules/react-native/react.gradle in your postinstall. Still a hack, but at least you can still just run npm/yarn install as needed and not have to manually reapply the fix. |
@ckwilhelm Right now I'm doing exactly as you suggest. But I don't like it. What if for some reasons the gradle file changes and I overwrite it with the old file. |
It has been included in the latest react-native release. |
@zszep can you confirm this has been fixed in the latest release? thank you. |
Right now I am on vacation. Will check it as soon as I return home.
… @zszep can you confirm this has been fixed in the latest release? thank
you.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#19211 (comment)
--
Voditelj Službe za informatiku KBC Osijek
|
@PierreBresson thank you :) |
I moved image files from |
Or alternatively delete |
Same problem, is there a proper solution ? |
This worked for me: https://stackoverflow.com/a/48985684 |
same error |
@PierreBresson |
Not working on 0.55.4 either |
@PierreBresson solution worked for me with RN 0.57.2 and patch-package
--- a/node_modules/react-native/react.gradle
+++ b/node_modules/react-native/react.gradle
@@ -72,6 +72,22 @@ afterEvaluate {
enabled config."bundleIn${targetName}" ||
config."bundleIn${variant.buildType.name.capitalize()}" ?:
targetName.toLowerCase().contains("release")
+
+ 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()
+ }
}
// Expose a minimal interface on the application variant and the task itself: |
well, i solved in this way:
|
Working for me. |
Or:
And add alias:
Save & exit.
If you have Now you can create a bundle with one command
Profit 😹 |
@Smolyan91 but with this solution u still use enableAappt2=false that will remove at the end of 2018 |
guys, do you have any proper solution without patching |
Probably, have to come up with another crutch ) |
I've upgraded my react native to 57.7
from gradle.properties remove android.enableAapt2=false #use the following command to bundle assets:
now generate release apk using following command.
|
Thanks @GaneshSaiKumar ! |
Please write guide how to right update gradle to version 5, and java 11.
|
@7laria's answer worked for me. Well, part of the answer did the trick. Along with step 1 and 2, just updated |
https://www.npmjs.com/package/patch-package It still has some limitations, but at least its not a full file overwrite... |
We are landing the fix for this right now. |

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
Expected Behavior
A generated apk at the end.
Actual Behavior
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)
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.
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.
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.
/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.
Execution failed for task ':app:processReleaseResources'.
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
The text was updated successfully, but these errors were encountered: