【发布时间】:2018-11-06 17:39:47
【问题描述】:
当我尝试构建我的项目时,我在 Android Studio 中收到此错误:
无法从 ..\src\main\AndroidManifest.xml 读取 packageName
我之前将我的项目从 Eclipse 迁移到 Android Studio 并且 AndroidManifest.xml 文件不在上面的目录中,它位于: ..\app\src\main\AndroidManifest.xml
当我创建 ..\src\main 目录并将AndroidManifest.xml 文件复制到其中时,我得到一个新错误列表,见下文。
我是否必须创建该目录,或者这是导致新错误的原因?:
..\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml:46: error: resource style/MyTheme (aka style/MyTheme) not found.
..\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml:57: error: resource string/app_name (aka string/app_name) not found.
..\build\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml:68: error: resource string/app_name (aka string/app_name) not found.
我已经阅读了与此类似的先前问题的答案,主要指向格式不正确的 xml 的问题,或者 build.gradle 中的 applicationId 与 AndroidManifest.xml 中的包不匹配,但不幸的是它们不适用在这种情况下。
以前有人遇到过这种情况吗?
【问题讨论】:
-
创建一个新项目并复制类和包。最快的方法真的
-
删除
/app/build、/build和/.idea文件夹,然后重试。 -
我听取了您的建议并创建了一个新项目并添加了所有类和 xml 文件,该项目现在正在运行。它创建的文件结构与从 Eclipse 迁移时不同。