Entry name 'AndroidManifest.xml' collided (Build failed after updating the android gradle plugin to 3.6.0)

怎甘沉沦 提交于 2020-05-25 06:26:38

问题


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


回答1:


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:

android.useNewApkCreator=false

More info please check the release note: https://developer.android.com/studio/releases/gradle-plugin#zipflinger




回答2:


I found a workaround by adding this to the app's build.gradle:

android {
    packagingOptions {
        exclude 'AndroidManifest.xml'
    }
}

I had this to fix an issue with creating a bundle, due to Facebook's Audience Network, on Android Studio 3.5.




回答3:


I get a similar error: Entry name 'resources.arsc' collided. Workaround as @Marco Batista said:

android {
    packagingOptions {
        exclude 'resources.arsc'
    }
}



回答4:


I had the same issue with AndroidManifest.xml files colliding. First, I tried the useNewApkCreator 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.



来源:https://stackoverflow.com/questions/60410331/entry-name-androidmanifest-xml-collided-build-failed-after-updating-the-andro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!