Entry name *.xml collided ultimate solution

We often encounter build success during development, and it can also be successful when installing the app directly through Android studio, but once the apk is packaged, it will report `Android error: Entry name'AndroidManifest.xml' collided`. I have encountered this problem a few times and it is a headache. Now I write it down on my blog and share it with everyone. There are a lot of solutions on the Internet, but there are problems or poor results.

Option 1: Return the gradle version to 3.5.3

The plan is feasible , but for an upgrade madman like me, it is impossible for me to downgrade after the upgrade, and the downgrade is unacceptable and it is not recommended to adopt it.

Option 2: Use the old packaging tool

The solution is feasible . Add the following content to the gradle.properties file. Android studio has made it clear that the packaging solution will be cancelled, and it is not recommended. The optimized new packaging solution is very advantageous in other aspects such as apk volume compression and cannot be solved. This problem loses other advantages and is not recommended.

android.useNewApkCreator=false

Solution 3: Delete all build files in the project

The plan is pure nonsense, no wool is used, the plan is not feasible

Solution 4: Shut down and restart or Invalidate Caches/Restart to restart Android studio

The plan will only make you more disappointed, the plan is not feasible

The ultimate solution: change the package generation path

The right thing is to change the path generated by the apk. For example, the default path of Android studio packaging is like this:

Waiting for you is `Entry name'res/layout/test_toolbar.xml' collided`

The solution is to change the path of the generated apk, such as

wonderful! The problem is solved. Change the path at will. If the selected folder path does not exist, create the folder first and then continue the operation to succeed.

 

2020.08.31 supplement

The @ ElaineTaylor1213  blogger in the comment area is right, as long as you delete the existing .apk in the .apk folder you are going to generate.

Guess you like

Origin blog.csdn.net/luo_boke/article/details/106113266