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

I ran into this when I upgraded from adt 14 to 15 and to get it to work I ended up just deleting the .eclipse folder (along with my settings) and re-installing the adt 15.

查看更多
残风、尘缘若梦
3楼-- · 2018-12-31 03:48

Solution for me:

  1. BACK UP YOUR CODE!
  2. Navigate to your project workspace (not your project) and run the following commands:

    dev1:workspace$ cd ~/Documents/workspace/.metadata/.plugins/ dev1:workspace$ rm -rf org.eclipse.core.resources

  3. Navigate to your Eclipse directory and type this command:

    dev1:eclipse$ ./eclipse clear

  4. Eclipse will start with an empty workspace - don't worry your projects are still there. Simple create new project from existing resource and things should be gravy.

The exact error I was receiving: [2012-02-07 14:15:53 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/v4/view/PagerAdapter; [2012-02-07 14:15:53 - ProjectCloud] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/view/PagerAdapter;

查看更多
长期被迫恋爱
4楼-- · 2018-12-31 03:50

None of the above helped. It was a simple problem in the end.

I had a project which uses the FacebookSDK and ViewPagerIndicator as library projects. All were built on Android API 16 and those two projects used the android support library vX (X not being 16!)

I added an external JAR to both those projects and pointed it to \extras\android\v4... And also removed the v4 jar I had in their libs folders.

Clean all projects and re-build.

Voilla!

The exact error I was receiving: Unable to execute dex: Multiple dex files define Landroid/support/v4/view/PagerAdapter; Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/v4/view/PagerAdapter;

查看更多
步步皆殇っ
5楼-- · 2018-12-31 03:50

For me, I just right click on project -> Build path -> configure build path -> Libraries -> remove dependency

after it works.

查看更多
深知你不懂我心
6楼-- · 2018-12-31 03:52

I was basically facing the same issue. I deleted the BIN folder, then removed unused jar files for Order and Import from eclipse. IT WORKED after that

查看更多
只靠听说
7楼-- · 2018-12-31 03:53

This error can happen if you have two jars that contains the same class names, e.g. I had two library: jsr311-api-1.1.1.jar, and jersey-core-1.17.1.jar, both containing the class javax.ws.rs.ApplicationPath. I removed jsr311-api-1.1.1.jar and it worked fine.

查看更多
登录 后发表回答