Reputation: 2032
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
Eclipse
.Android
Developer ToolsUpvotes: 398
Views: 451875
Reputation: 301
Delete generated R package from your referenced library. Sometimes Clean and Rebuild doesn't remove old R generated files.
Upvotes: 0
Reputation: 17131
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
Upvotes: 0
Reputation: 7074
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.
Upvotes: 2
Reputation: 52790
Go to Project/properties and Java Build Path and unchecked the Android Private Libraries.
Done
Upvotes: 18
Reputation: 109
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!
Upvotes: 3
Reputation: 4762
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'
Upvotes: 0
Reputation: 6737
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.
Upvotes: 1
Reputation: 961
[Solved for me]
Eclipse project properties->Java build path->Order and export
Uncheck Android private libraries.
Upvotes: 50
Reputation: 7699
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.
Upvotes: 20
Reputation: 9103
go to \bin\dexedLibs
and remove all the jars of the already removed libraries, then clean
Upvotes: 0
Reputation: 5173
Make sure that "android-support-v4.jar" is unchecked in Order and Export tab under Java Build Path
Follow the steps:
Upvotes: 3
Reputation: 683
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:
Project Name
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.
Upvotes: 462
Reputation: 7027
The issue is that "Android Dependencies" keep the reference to the old AdMob SDK even after:
The solution is to actually delete the AdMob SDK JAR from your computer, not just from the project.
Upvotes: 0
Reputation: 919
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
.
Upvotes: 2
Reputation: 11829
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.
Upvotes: 0
Reputation: 965
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.
Upvotes: 3
Reputation: 113
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
Upvotes: 2
Reputation: 31
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
Upvotes: 0
Reputation: 123
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!
Upvotes: 0
Reputation: 40126
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!
Upvotes: 2
Reputation: 676
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
Upvotes: 8
Reputation: 898
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...
Upvotes: 6
Reputation: 186
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...
Upvotes: 0
Reputation: 1
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
Upvotes: 0
Reputation: 251
Upvotes: 31
Reputation: 970
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.
To fix the problem I need to remove the library from the google-play-services_lib/libs directory (the jar it is used automatically)
Upvotes: 0
Reputation: 1762
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)
Upvotes: 6
Reputation: 919
[Solved for me]
by removing the duplicate library "JAR file" then remove BuildConfig.java file, Clean project and its work.
Upvotes: 4
Reputation: 3233
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:
It was along way to piece all that together from the other solutions! Phew!
Upvotes: 7