问题描述
我已经将我的android studio从 3.5.x 更新到了 3.6 ,并在生成签名变体版本的apk时出错,并显示以下消息-条目名称'res/layout/test_toolbar.xml'发生了冲突在整个项目中,我根本没有这样的布局.我有一个名为"阶段"的自定义构建变体,每当我尝试构建签名的apk时,它总是会失败.我指望找到任何解决方案.请帮我解决这个问题.谢谢
I have updated my android studio from 3.5.x to 3.6 today and getting error while generating signed apk for build variant showing the following message - Entry name 'res/layout/test_toolbar.xml' collidedI don't have any layout named like this one in the whole project at all. I have custom build variant named "stage" and whenever I am trying to build an signed apk, it always fails. I count find any solution yet. Please help me with this issue. Thanks
更新:这些以下消息也可能发生相同的问题(正如我在 AS-3.6.1 中发现的那样).因此,不必担心这些未知且无法解决的消息.到目前为止,我在生成签名的apk时发现了两种新型消息:
Update:Same issue can be occured with these following messages too (As I found it in AS - 3.6.1). So don't worry about these kind of unknown and not resolvable messages. So far I found two new type of messages while generating signed apk:
-
Entry name 'kotlin/collections/MapWithDefault.kotlin_metadata' collided
-
Access Denied
Entry name 'kotlin/collections/MapWithDefault.kotlin_metadata' collided
Access Denied
解决方案是相同的.有时您可能需要为此Invalidate Cache and Restart
您的AS.让我知道你的发现.谢谢
Solution is the same. Sometimes you may need to Invalidate Cache and Restart
your AS for this. Let me know your findings. Thanks
推荐答案
在阅读下面的解决方案之前,请先阅读我从2020年1月4日开始的更新,问题更加严重,并且在您的中代码.
Before reading solution below, please read my update from 01.04.2020, the problem is deeper and it is in your code.
在此3.6更新之后,我遇到了同样的问题.
* fast 解决方案是:*
*The fast solution is:*
- 删除projectFolder \ build
- 删除projectFolder \ debug *
- 删除projectFolder \ release *
- 删除projectFolder \ app \ build
- 删除projectFolder \ app \ build \ debug *
- 删除projectFolder \ app \ build \ release *
因此您需要删除所有构建,调试和发布目录.
请注意,您可能无法删除整个 debug和发布目录,但可以删除所有目录.
Note that you may be not able to delete whole debug and release directories, but you can delete all of it contents.
UPD:
我认为他们已经解决了该错误:
I think they have fixed this bug today:
UPD 03.03.2020:不幸的是,错误无法修复.
UPD 03.03.2020:Unfortunatelly, bug doesn't fixed.
UPD 01.04.2020:(不是4月1日的笑话:))
UPD 01.04.2020:(Not 1st April joke:) )
自一个月以来,我与Android Studio开发人员一起工作,今天被告知要使用jdk而不是jre,因为日志中的一个深层错误称它为It.
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.
设置了jdk(文件->项目结构-> SDK位置-> JDK位置)而不是jre之后,我遇到了一些其他错误,这些错误未显示在"build output"中,所以我运行 Analyze-> Inspect Code 并得到 EIGHTEEN 错误,例如在布局中引用错误的视图ID,方向错误(至tools:ignore="MissingDefaultResource"
)和清单错误.方向:我读到这是3.6.1中的一些新更新-关于风景或肖像screenOrientation
,由Studio通过以下方法快速修复:<activitytools:ignore="LockedOrientationActivity" />
After setting jdk (File->Project Structure->SDK Location->JDK Location) instead of jre, I've got some another errors which were not showed in "build output" so I run Analyze -> Inspect Code and got EIGHTEEN errors such as refering 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:<activitytools:ignore="LockedOrientationActivity" />
通过分析->检查代码"修复了所有错误后,我已经成功使用jdk和jre(仅用于测试)生成了带签名的APK.
因此,总而言之,此错误是由深层错误引起的,只有使用Inspect Code
工具才能发现该错误.
So in summary, this bug caused because of deep errors which you can find out only with Inspect Code
tool.
我认为AS不会认为这是一个错误,我想他们会说这是用于改进代码的新功能.另外,我认为即使没有设置jdk而不是jre,您也应该尝试检查代码.
I think AS will not think that this a bug, I think they will said 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.
AS支持部门的其他建议:
BTW在导出release
版本时,我们还会运行lintVital
,它会做一些额外的检查,并且会有一些错误标记为fatal
.此检查非常昂贵,因此在debug
版本
BTW when exporting a release
build, we also run lintVital
which does some extra checks and have some errors marked as fatal
. This check is expensive so it does not happen in debug
builds
这篇关于收到错误消息-“条目名称'res/layout/test_toolbar.xml'发生冲突";在创建签名的apk时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!