获取错误说 - “条目名称 'res/layout/test_toolbar.xml' 发生冲突";在创建签名的 apk 时 [英] Getting error says - "Entry name 'res/layout/test_toolbar.xml' collided" while creating signed apk

查看:26
本文介绍了获取错误说 - “条目名称 'res/layout/test_toolbar.xml' 发生冲突";在创建签名的 apk 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我今天已将我的 android studio 从 3.5.x 更新到 3.6,但在为构建变体生成签名 apk 时出现错误,显示以下消息 - Entry名称 'res/layout/test_toolbar.xml' 发生冲突我在整个项目中根本没有任何像这样命名的布局.我有一个名为stage"的自定义构建变体;每当我尝试构建签名的 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

更新:以下这些消息也会出现同样的问题(正如我在 AS - 3.6.1 - 有时继续使用 4.x.x 中发现的那样).所以不要担心这些未知和不可解析的消息.到目前为止,我在生成签名的 apk 时发现了两种新类型的消息:

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:

  • 条目名称kotlin/collections/MapWithDefault.kotlin_metadata"发生冲突
  • 访问被拒绝

结果是一样的.有时您可能需要为此使缓存无效并重新启动您的 AS.让我知道你的发现.谢谢

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 projectFolder\build delete projectFolder\debug
  2. 删除项目文件夹\发布
  3. 删除 projectFolder\app\build
  4. 删除 projectFolder\app\build\debug
  5. 删除 projectFolder\app\build\release

所以你需要删除所有的构建,调试和发布目录.

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

请注意,您可能无法删除整个 debug 和 release 目录,但可以删除其所有内容.

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

推荐答案

在阅读下面的解决方案之前,请阅读我 01.04.2020 的更新,问题更深,它在你的 代码.

我在 3.6 更新后遇到了同样的问题.

快速的解决方案是:

  1. 删除 projectFolder\build
  2. 删除 projectFolder\debug*
  3. 删除 projectFolder\release*
  4. 删除 projectFolder\app\build
  5. 删除 projectFolder\app\build\debug*
  6. 删除 projectFolder\app\build\release*

因此您需要删除所有构建、调试和发布目录.

请注意,您可能无法删除整个调试和发布目录,但可以删除其所有内容.

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

更新:

我认为他们今天已经修复了这个错误:

I think they have fixed this bug today:

2020 年 3 月 3 日更新:不幸的是,该错误并未修复.

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

2020 年 4 月 1 日更新:(不是 4 月 1 日的笑话:))

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

自从一个月以来我与 Android Studio 开发人员一起工作,今天我被告知使用 JDK 而不是使用 JRE,因为日志中的一个深层错误说它.

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 后,我还有一些其他错误未在构建"中显示输出"所以我运行 Analyze ->检查代码并得到8个错误,例如在布局中引用错误的视图ID、方向错误(您好,tools:ignore=MissingDefaultResource")和清单中的错误也与方向有关:我读到这是 3.6.1 中的一些新更新 - 关于横向或纵向 screenOrientation,由 Studio 快速修复:

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" />

当所有错误都通过分析修复时 ->检查代码,我已经使用 JDK 成功生成了一个签名的 APK,然后使用 JRE(仅用于测试).

总而言之,这个错误是由于深度错误导致的,您只能使用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 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.

来自 AS 支持的其他建议:

顺便说一句,在导出 release 构建时,我们还会运行 lintVital,它会进行一些额外的检查,并将一些错误标记为 fatal.这个检查很昂贵,所以它不会发生在 debug 构建

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

这篇关于获取错误说 - “条目名称 'res/layout/test_toolbar.xml' 发生冲突";在创建签名的 apk 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆