无法执行DEX:多DEX文件定义LCOM / MyApp的/ R $阵列;阵列、定义、文件、DEX

2023-09-11 10:25:31 作者:旧情难忘° moment

由于更新到 ADT 14,我可以不再建立我的项目。这是建设优良之前更新。

Since updating to ADT 14 I can no longer build my project. It was building fine prior to updating.

错误:

[2011-10-23 16:23:29 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;
[2011-10-23 16:23:29 - myProj] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;

类似的问题已经被报告了,我已经试过的建议有包括

Similar issues have been reported and I have tried the suggestions there including

重新启动的Eclipse 。 清洁工程,重建 - 禁用项目 - >自动构建选项,然后在清洁和建设的项目,然后尝试运行。 RESET自动构建选项,在 重新安装安卓开发工具 重新安装Eclipse(更新至最新版本3.7.1) 创建一个新项目从文件系统导入 从创建颠覆一个新的项目。 Restarting Eclipse. Cleaning the project and rebuild - Disable "Project->Build Automatically" option, then "Clean" and "Build" project, then try to run. reset "Build Automatically" option to On Re-installing the Android Developer Tools Re-installing Eclipse (updated to the latest version 3.7.1) Created a new project importing from the file system Created a new project from subversion.

推荐答案

我有同样的问题,很奇怪,因为它是唯一使用Eclipse时发生(但它是确定使用Ant)。 这是我如何固定它:

I had the same problem, quite weird because it was happening only when using Eclipse (but it was OK with Ant). This is how I fixed it:

右键点击项目名称 选择构建路径 - > 配置构建路径

Java构建路径,转到标签订单和出口 Right click on the Project Name Select Build Path -> Configure Build Path

In Java Build Path, go to the tab Order and Export

取消选中你的的.jar

只是有时: 为了和导出选项卡,我没有任何的jar库在那里,所以我未选中Android的私人图书馆项目。现在我的项目正在运行。

Only sometimes: In Order and Export tab I did not have any jar library there, so I have unchecked Android Private Libraries item. Now my project is running.