Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
374 views
in Technique[技术] by (71.8m points)

android - Getting error says - "Entry name 'res/layout/test_toolbar.xml' collided" while creating signed apk

I have updated my android studio from 3.5.x to 3.6 today and getting an error while generating signed apk for build variant showing the following message - Entry name 'res/layout/test_toolbar.xml' collided I don't have any layout named like this one in the whole project at all. I have a custom build variant named "stage" and whenever I am trying to build a signed apk, it always fails. I count find any solution yet. Please help me with this issue. Thanks

Update: The same issue can occur with these following messages too (As I found it in AS - 3.6.1 - Continues with 4.x.x sometimes). So don't worry about these kinds of unknown and not resolvable messages. So far I found two new types of messages while generating signed apk:

  • Entry name 'kotlin/collections/MapWithDefault.kotlin_metadata' collided
  • Access Denied

The result is the same. Sometimes you may need to Invalidate Cache and Restart your AS for this. Let me know your findings. Thanks

The fast solution is: (as of the most popular answer and I agree)

  1. delete projectFolderuild delete projectFolderdebug
  2. delete projectFolder elease
  3. delete projectFolderappuild
  4. delete projectFolderappuilddebug
  5. delete projectFolderappuild elease

So you need to delete all of the builds, debug and release directories.

Note that you may be not able to delete the whole debug and release directories, but you can delete all of its contents.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Before reading the solution below, please read my update from 01.04.2020, the problem is deeper and it is in your code.

I've got the same problem after this 3.6 update.

The fast solution is:

  1. delete projectFolderuild
  2. delete projectFolderdebug*
  3. delete projectFolder elease*
  4. delete projectFolderappuild
  5. delete projectFolderappuilddebug*
  6. delete projectFolderappuild elease*

So you need to delete all of the builds, debug and release directories.

Note that you may be not able to delete whole debug and release directories, but you can delete all of its contents.

UPDATE:

I think they have fixed this bug today: enter image description here

UPDATE 03.03.2020: Unfortunately, the bug doesn't fix.

UPDATE 01.04.2020: (Not 1st April joke:) )

Since month I worked with Android Studio developers and today I was told to use JDK instead of using JRE, because one of deep errors in logs said It.

After setting JDK (File->Project Structure->SDK Location->JDK Location) instead of JRE, I've got some other errors that were not shown in "build output" so I run Analyze -> Inspect Code and got EIGHTEEN errors such as referring to wrong view id in layouts, errors with orientation (hi to tools:ignore="MissingDefaultResource") and errors in manifest also with orientation: I read that this is some new update in 3.6.1 - about landscape or portrait screenOrientation, fixed fast by Studio with this: <activity tools:ignore="LockedOrientationActivity" />

When all of the errors were fixed with Analyze -> Inspect Code, I have successfully generated a signed APK using JDK and then using JRE (just for test).

So in summary, this bug caused because of deep errors which you can find out only with Inspect Code tool.

I think AS will not think that this is a bug, I think they will say that this is a new feature for improving your code. Also, I think you should try to inspect your code even without setting JDK instead of JRE.

Additional recommendation from AS support:

BTW when exporting a release build, we also run lintVital which does some extra checks and has some errors marked as fatal. This check is expensive so it does not happen in debug builds


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...