Unable to execute dex: Multiple dex files define L

2018-12-31 03:28发布

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

The error:

[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

  • 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.

30条回答
一个人的天荒地老
2楼-- · 2018-12-31 03:35

You have probably installed r14, this error may have been caused due to the platform tools update, you have to re-install your sdk

查看更多
浪荡孟婆
3楼-- · 2018-12-31 03:36

Go to Project/properties and Java Build Path and unchecked the Android Private Libraries.

This is also another case for this kind of error

Done

查看更多
明月照影归
4楼-- · 2018-12-31 03:36

I have several library projects with the same package name specified in the AndroidManifest (so no duplicate field names are generated by R.java). I had to remove any permissions and activities from the AndroidManifest.xml for all library projects to remove the error so Manifest.java wasn't created multiple times. Hopefully this can help someone.

查看更多
刘海飞了
5楼-- · 2018-12-31 03:38

Modify your eclipse.ini file and set the maximum memory parameter to

-Xmx1024m

Then restart your computer.

It worked for me.

查看更多
妖精总统
6楼-- · 2018-12-31 03:39

I converted a non-library project to a library project, but it had a previously built jar file in the libs folder. Removing this jar file caused this error to go away.

查看更多
情到深处是孤独
7楼-- · 2018-12-31 03:40

As others have mentioned, this occurs when you have multiple copies of the same class in your build path - including bin/ in your classpath is one way to guarantee this problem.

For me, this occurred when I had added android-support-v4.jar to my libs/ folder, and somehow eclipse added a second copy to bin/classes/android-support-v4.jar.

Deleting the extra copy in bin/classes solved the problem - unsure why Eclipse made a copy there.

You can test for this with

grep -r YourOffendingClassName YourApp | grep jar

查看更多
登录 后发表回答