By terry


2011-10-24 00:14:19 8 Comments

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 comments

@alex 2018-03-24 23:43:24

Delete generated R package from your referenced library. Sometimes Clean and Rebuild doesn't remove old R generated files.

@Ahmad Aghazadeh 2017-01-06 07:33:33

If you use 'com.google.android.gms:play-services' You can add what you really need to look at the following list:

Google+ com.google.android.gms:play-services-plus:10.0.1

Google Account Login com.google.android.gms:play-services-auth:10.0.1

Google Actions, Base Client Library com.google.android.gms:play-services-base:10.0.1

Google Address API com.google.android.gms:play-services-identity:10.0.1

Firebase App Indexing com.google.firebase:firebase-appindexing:10.0.1 Google Analytics com.google.android.gms:play-services-analytics:10.0.1

Google Awareness com.google.android.gms:play-services-awareness:10.0.1

Google Cast com.google.android.gms:play-services-cast:10.0.1

Google Cloud Messaging com.google.android.gms:play-services-gcm:10.0.1

Google Drive com.google.android.gms:play-services-drive:10.0.1

Google Fit com.google.android.gms:play-services-fitness:10.0.1

Google Location and Activity Recognition com.google.android.gms:play-services-location:10.0.1

Google Maps com.google.android.gms:play-services-maps:10.0.1

Google Mobile Ads com.google.android.gms:play-services-ads:10.0.1

Google Places com.google.android.gms:play-services-places:10.0.1

Mobile Vision com.google.android.gms:play-services-vision:10.0.1

Google Nearby com.google.android.gms:play-services-nearby:10.0.1

Google Panorama Viewer com.google.android.gms:play-services-panorama:10.0.1

Google Play Game services com.google.android.gms:play-services-games:10.0.1

SafetyNet com.google.android.gms:play-services-safetynet:10.0.1

Android Pay com.google.android.gms:play-services-wallet:10.0.1

Android Wear com.google.android.gms:play-services-wearable:10.0.1

@Rob 2016-12-01 04:01:24

This was the top result when I searched for this error in Google.

Though the question doesn't ask how to solve this issue in regards to React Native, I thought I would share anyway for anyone who ends up here and is using React Native.

From the project root run:

  • cd android && ./gradlew clean [Mac - Bash Terminal]
  • cd android & gradlew clean [Windows - Command Prompt]

Then react-native run-android to build and run again.

@Hiren Patel 2015-01-06 10:44:07

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

@hi0001234d 2015-08-30 07:12:28

I had tried most of the above solution and in past some of them had worked.

But this time none of them worked, so i had deleted my library project's .jar file. and rebuild both library and application project.

And this time it's worked!

@sonique 2015-07-01 06:24:52

Spliting Google Play Service could help you : https://developers.google.com/android/guides/setup#split

so instead of adding just play-services :

compile 'com.google.android.gms:play-services:7.5.0'

you add only what you need :

// Google Maps only
compile 'com.google.android.gms:play-services-maps:7.5.0'

@Naveed Ahmad 2015-02-25 13:26:09

I resolved this issue in my project by deleting a library:

Reason: I included a library-project in my project, and mistakenly did not removed the previous lib from my project, so when I was running the project then same library dex files were generating twice, when I removed the same-library from lib folder of my project, the error gone away and build was created successfully, I hope others may face the same issue.

@comodoro 2017-09-25 14:06:28

Seems stupid, but I have run into the same apparently. Solving a dependency error I added a jar and forgot to delete the dependency in build.gradle

@user802467 2014-11-11 01:56:59

[Solved for me]

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

Uncheck Android private libraries.

@redux 2015-01-28 16:54:07

Didn't help in my case

@Shylendra Madda 2015-03-05 09:56:49

Awesome..It saved my day..Thanks..

@ant2009 2015-03-23 11:10:11

This work for me also, thanks.

@madhu sudhan 2015-04-10 06:02:00

THANX A LOT helped me

@hitesh141 2015-05-19 08:18:32

thanks.. it's working

@Mateus Viccari 2013-08-11 23:21:42

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.

@swiftBoy 2013-10-25 06:45:30

This is the perfect solution for me. I added same libs twice. Thanks.

@Muhammed Refaat 2014-10-27 09:37:19

go to \bin\dexedLibs and remove all the jars of the already removed libraries, then clean

@Muhamed Riyas M 2014-08-19 13:40:42

Make sure that "android-support-v4.jar" is unchecked in Order and Export tab under Java Build Path

Follow the steps:

  1. Project Properties
  2. Java Build path
  3. Order and Export
  4. Uncheck "android-support-v4.jar"

@Marco Bonifazi 2013-05-17 10:03:24

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:

  • Right click on the Project Name
  • Select Build Path -> Configure Build Path
  • In Java Build Path, go to the tab Order and Export

  • Uncheck your .jar library

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.

@Chris Feist 2013-08-14 19:03:26

In my project, I was including the support library from the sdk directory in my build path, and I had the support library in the "libs" folder for support of ant building. I unchecked one and it fixed my issue.

@Tom Pace 2013-09-26 17:20:43

Sometime between the last time building and launching, a new library appeared mysteriously in my project: "Android Private Libraries" containing the support library I was already referencing. So this mysterious "multiple dex files define ____" appeared. Checking the Java Build Path and seeing this new item, and unchecking the originally-included support library solved the problem for me.

@roy mathew 2013-11-01 08:47:29

Thanks a lot. This is the correct solution. I really do not know why eclipse has this much bugs. Now the situation is like only 2 hours I can code and 6 hours I have to find solution to this kinds of unnecessary issues.

@Junior M 2014-01-18 22:57:12

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.

@jeet.chanchawat 2014-05-06 09:06:23

Reason : Its because the library imported and the library used in our code clash. Suggestion: always remove the dependency from library... not from the source. as there might be the the requirement of importing one more library in future.

@Bart Burg 2014-05-09 09:14:32

I had to uncheck the android support library in order/export. Strangely, i didn't change anything before this bug appeared.

@ymerdrengene 2014-07-17 13:01:13

In my case I had a dublicate of ´android-support-v4.jar´. When i deleted it, the error went away

@Ramakishna Balla 2014-08-04 16:20:29

Sooper dude...this is the solution. This error generally kills atleast couple of hours of time for every developer before he realizes that this is the solution...and...I'm no exception in this case :( :) Finally...it is running smooth

@Alston 2014-10-28 03:40:14

I move up the projectName/src to the top and then projectName/gen and it works.

@Manny265 2015-03-05 11:37:50

All this didnt work until I tried to uncheck the private libraries and clean the project that totally worked thank you

@userDroid 2015-09-10 04:58:52

Try to change the target version of all project.This works for me

@Sterling Diaz 2014-04-15 13:53:32

Check that your bin folder is not in the build path.

@Hugo Gresse 2015-04-07 09:35:22

Can you explain how to remove the bin folder from build path ?

@Sterling Diaz 2015-05-06 17:19:19

If it is, it have a remove button, in the 4 tabs of the Build Path Configuration window.

@thiagolr 2014-04-04 10:09:56

The issue is that "Android Dependencies" keep the reference to the old AdMob SDK even after:

  • remove the old admob sdk from build path
  • ant clean
  • eclipse clean
  • delete the bin and gen folders manually
  • close / open eclipse
  • update sdk tools
  • update adt

The solution is to actually delete the AdMob SDK JAR from your computer, not just from the project.

@AbuQauod 2014-03-26 12:03:36

This happen when in our app, we have libs folder with gson jar (eg: gson-2.2.4.jar). In sametime, our Google Play Service library already have Gson as well.

i have remove it from my app and its work fine now.

@erdomester 2014-03-21 16:09:49

This error occurred to me when I imported a .jar file (as a matter of fact it was httpmime-4.3.jar) and tried to use it. For me the solution was easy: I removed the .jar file from the libs folder and deleted it from Order and Export. Ran the project again, it worked, so I added the .jar file again and it was finally okay.

@Dinesh 2014-03-12 15:08:01

I am facing the same problem. The problem I found that I have a library project, in that project's manifest file, there is no targetSdkVersion property. I have added that property under (uses-sdk) tag. Then clean my project. Now my app runs normally.

@Doron Zehavi 2014-02-05 12:57:09

Found another scenario where this issue happens: The problem was that the libs folder was used as a Source in the project preferences, so it was exported twice. Resolved by right clicking on the libs folder -> Build Path -> Remove from Build Path

@The Demz 2014-08-25 07:54:23

If the library is imported several times this error will occur. Check the Java Build Path if there are several imports of the same .jar file.

@pdxwebdev 2014-02-04 03:31:02

Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/zxing/BarcodeFormat;

Posting this answer for those receiving this error with regards to the barcode scanner plugin from zxing.

Just delete the jar file in the libs folder. Should be project/libs/com.google.zxing.client.android.captureactivity.jar

@ItsMeMario 2013-11-13 11:49:41

In my case, I delete the ".apk" file in the "src/com/..." directory, clean the project and run.

I had tried all the previous suggestions and did not work for me!

@Sazzad Hissain Khan 2013-11-06 19:45:56

NON OF THE ABOVE METHODE WORKED FOR ME BUT MINE IS WORKED LIKE A CHARM!

The problem happens when user builds the dependent library with eclipse. So to get the solution

Step 1: Delete the library (like support library project v4 or v13) from Eclipse with delete workspace source permanantly

Step 2: Re import the library and include it to your project

Step 3: Clean and Rebuild

DONE!

@Ahsan Zaheer 2013-09-20 11:01:43

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

@Dediqated 2013-09-10 07:22:38

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

@user1859771 2013-08-12 09:21:06

i had the same problem unable to execute multipledex files in android --lorg\xhtml\CSS

i deleted 2external jars files in lib folder--core-renderer-3043e0f89ffb2.jar

core-renderer-minimal-e70d6a.jar and my project built fine again...

@Fernando 2013-06-13 04:10:40

I had this problem and solved it by changing the path of the. jar for change directory, but the. jar pulled the other side, change the path and I entered without problem

@Mohit marwal 2012-04-21 06:46:43

  1. Close eclipse.
  2. Delete bin folder inside your project folder.
  3. Start eclipse and clean your project.
  4. Now run and the problem should be gone

@Vicky Kapadia 2012-05-05 07:34:08

does not help..

@swiftBoy 2013-10-25 06:46:34

Mateus Viccari's answer solved my problem, I removed duplicate libs, and it works like charm..

@Mehul Joisar 2013-11-27 05:18:40

Worked for me.If manifest file get removed by eclipse from bin directory,add it manually and clean project again.

@Magnus W 2014-04-26 10:11:17

Works for me. Also make sure you don't have the same .jar in two different places (in my case I had it both in a library project and in a project referencing that library project. Seems Eclipse just added it automatically for some reason)

@tricknology 2014-08-14 16:41:35

For me, I just cleaned the ENTIRE workspace. Simply cleaning the project was not enough. I believe my problem had to do with switching one of the projects to "Library" in the middle of a clean operation

@redux 2015-01-28 16:51:06

Didn't help in my case

@Gugelhupf 2013-05-16 09:44:08

I got the same error message with the GooglePlayService library project google-play-services.jar .

We use maven, for this reason I have to add the Library in my local maven repository.(mvn install:install-file -Dfile=xxx)

Now the library is twice in the "Java Build Path" -> Libraries.

  • once in Android Dependencies
  • and once in the Maven Dependencies.

To fix the problem I need to remove the library from the google-play-services_lib/libs directory (the jar it is used automatically)

@jp093121 2013-04-29 04:24:09

found a solution i believe??

    [2013-04-28 23:56:09 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/coremedia/iso/AbstractBoxParser$1;

Where it says : "Lcom/coremedia/iso/AbstractBoxParser$1" that just happen to be the location of the library I imported that was causing the issue. Looked for com.codemedia.iso.AbstractBoxParser$1.class and .AbstractBoxParser.class.... took that jar, unpackaged it, removed both of those files, then repackaged as a .zip, added to library, cleaned and worked! no more conflict for me! (also no updates or additional downloads)

@AbuQauod 2013-04-28 09:04:53

[Solved for me]

by removing the duplicate library "JAR file" then remove BuildConfig.java file, Clean project and its work.

@Jay 2013-04-05 00:23:01

I'm late to this party, but adding my own experience so I can find it again later :)

I ran into this problem after upgrading the android sdk and eclipse ad-ins. No upgrade goes unpunished!

The problem for me was related to library projects, my app references both standard java projects and android library projects. I noticed the Java Build Path settings were including the android library projects src and res folders in the Source list (upvotes to everyone that mention bin in source being issue, src and res was also an issue.)

So the solution was:

  1. Remove all referenced Android libraries source and project references from the Java Build Path section of the settings in both Source list and Project list
  2. Make sure pure java dependencies are listed in Project list, and Checked in the Order and Export tab so the classes are included in the apk
  3. Make sure all Android library dependencies are listed on the Android section of project properties, in the library section below the checked SDK versions.

It was along way to piece all that together from the other solutions! Phew!

@strangeluck 2013-09-26 19:33:29

Well stated! I came to identical conclusions after a lot of work. I just wanted to add that it if any of your library projects include other library projects or pure-Java dependencies, that they must all be added the same way, otherwise this error will arise. If you follow the rules above for all your projects, you shouldn't have any problems.

@strangeluck 2013-09-27 12:28:51

One more thing... it appears that if you don't need to export the Android Private Libraries of a project or library project, don't. If more than one project or library project exports it, you'll get the multiple dex files error.

Related Questions

Sponsored Content

1 Answered Questions

9 Answered Questions

[SOLVED] Unable to execute dex: GC overhead limit exceeded in Eclipse

4 Answered Questions

[SOLVED] Android unable to execute dex

  • 2012-02-03 01:02:58
  • whwright
  • 5121 View
  • 2 Score
  • 4 Answer
  • Tags:   android

5 Answered Questions

[SOLVED] Unable to execute dex: Multiple dex files define Lcom/.... yet again

17 Answered Questions

[SOLVED] Dex Loader Unable to execute Multiple dex files define

  • 2011-10-07 14:41:07
  • DreamHawk
  • 73790 View
  • 29 Score
  • 17 Answer
  • Tags:   android loader dex

1 Answered Questions

[SOLVED] Unable to execute dex: Multiple dex files define Lcom/facebook/AccessToken$1

3 Answered Questions

0 Answered Questions

Unable to execute dex: Multiple dex files define in Android

1 Answered Questions

[SOLVED] Multiple dex file

  • 2013-07-10 16:03:00
  • Gaurav Gupta
  • 1424 View
  • 1 Score
  • 1 Answer
  • Tags:   dex

Sponsored Content