I have recently update the Android studio from 3.5(stable) to 3.6(stable).
Then I saw the plugin update is also available, so I have update the version of "com.android.tools.build:gradle" from 3.5.0 to 3.6.0 and also update the gradle version to 5.6.4
Now problem starts when I try to build the project it fails with message Entry name 'AndroidManifest.xml' collided
There are few methods to resolve this issue.
Revert build.gradle version to 3.5.3
Add packagingOptions under app/build.gradle
Under gradle.properties, set useNewApkCreator to false. Adding this flag might cause some apk installation issues.
Final approach, perform a scan through third-party library. Check for androidx.core:core-ktx plugin. Try to update to 1.2.0 or newer version.
I found a workaround by adding this to the app's build.gradle:
I had this to fix an issue with creating a bundle, due to Facebook's Audience Network, on Android Studio 3.5.
According to the issue this happens when a JAR dependency contains an
AndroidManifest.xml
file.For my project, the cause was this old dependency:
Which had a dependency on
com.google.android:android:4.1.1.4
which had anAndroidManifest.xml
in the JAR.How I found it
I searched in
$HOME\.gradle\caches\modules-2\files-2.1
for all.jar
files containing anAndroidManifest.xml
(I used Total Commander)Then I cross referenced the results with the dependencies of my app. To get the dependency tree use the Gradle tool window to run the Tasks/android/androidDependencies gradle task.
I had the same issue with
AndroidManifest.xml
files colliding. First, I tried theuseNewApkCreator
workaround and it worked on the app variant I was working on. But when I switched to another variant, build was still successful but the app refused to install from Android Studio. Also installing the .apk manually gave parsing error on the device.Finally, I analyzed the .apks from both variants and noticed that the broken .apk had the wrong AndroidManifest.xml in it. Excluding the manifest in
packagingOptions
worked though.This is caused by Android Gradle plugin 3.6, revert to using the old packaging tool by including the following in your gradle.properties file will fix this:
More info please check the release note: https://developer.android.com/studio/releases/gradle-plugin#zipflinger
I get a similar error: Entry name 'resources.arsc' collided. Workaround as @Marco Batista said: