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:41

I was getting this error after adding the facebooksdk.jar to a project that already had dependencies on the android-support-v4.jar. Since the facebooksdk.jar already includes its own android-support-v4.jar there were conflicts. Removing the earlier android-support-v4.jar from the projects Properties / Java Build Path / Libraries resolved the issue for me.

查看更多
泪湿衣
3楼-- · 2018-12-31 03:43

I had two different versions of Cordova .jar-files in my libs folder, I deleted the one I wasn't even using and it worked right away. Weird because I didn't notice that before and it worked before and then suddenly stopped working...

查看更多
墨雨无痕
4楼-- · 2018-12-31 03:43

After trying all the other suggestions with no luck, I deleted all the contents of my projects 'bin' directory, then ran eclipse again and it worked.

查看更多
君临天下
5楼-- · 2018-12-31 03:46

My problem was resolved after cleaning up some directories and files left over from the previous versions of the tools. ADT Rev 14 changes where binaries are stored. I deleted the entire bin directory, restarted Eclipse and cleaned the build and forced a rebuild. That seemed to do the trick initially but the problem came back after the next run.

I finally discovered that my bin directory was included in the project build path. I excluded bin from the build path and repeated the steps above. This resolved my problem.

查看更多
墨雨无痕
6楼-- · 2018-12-31 03:46

The ADT R14 update changes where the classes go to the bin/classes directory (see http://tools.android.com/recent/buildchangesinrevision14). If you are using ANT, you should change the path for your classes from bin to bin/classes. This worked for me.

查看更多
后来的你喜欢了谁
7楼-- · 2018-12-31 03:48

[Solved for me]

Eclipse project properties->Java build path->Order and export

Uncheck Android private libraries.

查看更多
登录 后发表回答