Eclipse, Android: Unexpected Unable to execute dex: Multiple dex files define - android

The problem:
I can't built my project. When I try the following sign is shown in the Console:
[2014-09-28 23:49:30 - Dex Loader] Unable to execute dex: Multiple dex files define Landroid/support/annotation/AnimRes;
[2014-09-28 23:49:30 - Shop] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Landroid/support/annotation/AnimRes;
I lost hours of searching for a solution for this problem, but no result.. I tried to clean the project, to delete the bin folder etc. but nothing worked..
Please, help, I don't know what to do..

Remove android-support-annotations.jar from libs folder. As these annotations are already included in recent versions of the android-support-v4.jar file.

I couldn't fix it so I ended up by creating new project in a different workspace and copied all the code to the new project. It's not the smartest thing but what can I do..

I lost several hours too in this problem but i think that I found a solutiĆ³n, at least for my.
Andoid Studio said me that i had "Multiple dex files define Landroid/support/annotation/AnimRes;" but he said also had a file call inputList.txt that had a bug.
Well, i found this file in directory tree and i found in app/build/intermediates/tmp/dex/debug folder. The file is a simple textfile that had one row for each dependence as support-annotations or androidplot-core with a absolute path.
I saw several row repeated and i thought that if i remove i solve the problem, but it didn't work.
Then I searched this route and all .jar are in the same place: app/build/intermediates/pre-dexed/debug/ folder, and I saw repeated .jar files and I removed this, after i went to the file and I erased repeated rows too.
Then I run my project and the bug disappeared, the problem it solved.
The problem was then: .jar files duplicated in that folder.
Easy!

I have same problem. I think it was happen because there are modification in bin folder contents when I update project repository with tortoise SVN.
I have removed bin, and Eclipse generate new one but the problem still persist. But I resolved problem by removing android dependency library. Here the steps :
Select Project -> Right Click -> Select Build Path -> Configure Build Path -> In Libraries tab remove Android Dependencies -> OK. Then clean the project and run again. :)

Remove the library which contains android-support-v4.jar,then add the android-support-v4.jar to buid path direct. By the way,I use Eclipse for IDE.

As the console output said "Multiple dex files define".
Under ther bin/dexedLibs, there many jars with the same name but of different version.
I solve it by remove all the duplicated support v4 jars under all the lib folders and make my main project reference to the single one in the library project, then clean the project to rebuild.It works as a charm now.

Related

"DexException: Multiple dex files define" using Weibo SDK [duplicate]

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.
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.
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.
[Solved for me]
Eclipse project properties->Java build path->Order and export
Uncheck Android private libraries.
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;
This problem was happening me, I had an external .jar in my libs folder called gson-2.2.2.jar but for some reason there were two of them, gson-2.2.2.jar and gson-2.2.2.jar(1), I simply deleted the latter and my project built fine again.
Close eclipse.
Delete bin folder inside your project folder.
Start eclipse and clean your project.
Now run and the problem should be gone
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
For me, I just right click on project -> Build path -> configure build path -> Libraries -> remove dependency
after it works.
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.
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.
Go to Project/properties and Java Build Path and unchecked the Android Private Libraries.
Done
I removed Android dependencies from build path and it worked.
Edit: ignore that. I had same jar in my maven dependencies and libs folder. I removed the one at the lib folder.
You have probably installed r14, this error may have been caused due to the platform tools update, you have to re-install your sdk
For me this problem only exists as long as there are Android library projects involved in my project. So when I remove all the libraries and do as you said I can run my app again.
If there are libraries involved even the bin-removal-trick trick won' work.
I don't get why this bug first appeared today since I'm using ADT 14 for several days now. Well there were other bugs that kept me happy though.
Deleting the bin folder was not enough, I also deleted the gen folder. Then after two rebuilds the dex error message was gone.
Select the project in Project Explorer, right-click and select Properties -> Java Build Path -> Source -> Check the box for Allow output folders for source folders
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
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:
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
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
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!
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.
After reading Terrys response about deleting the bin directory and Larrys about the the location of the ANT directory:
I moved the files located in my projects BIN directory to the BIN/CLASSES and im up and running.
Edit 1
Then failed on second run...doh
Edit 2
So closed Eclipse moved files back to original location and its all working... um what?
I don't pretend to know why this worked. Will update if any changes.
Edit 3
I have noted from my backups that there were indeed duplicate files in the BIN directory and BIN/CLASSES.
So the answer is: don't have files in both locations. At least for me that's what worked.
Modify your eclipse.ini file and set the maximum memory parameter to
-Xmx1024m
Then restart your computer.
It worked for me.
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)
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...
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.
Solution for me:
BACK UP YOUR CODE!
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
Navigate to your Eclipse directory and type this command:
dev1:eclipse$ ./eclipse clear
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;
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.
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.
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.
I was facing the same issue then i saw while pushing my app some jar files which were loaded twice hence multiple dex error .Just go to your project properties -> Java Build Path and try unchecking jar which is being loaded twice.
[Solved for me]
by removing the duplicate library "JAR file" then remove BuildConfig.java file, Clean project and its work.

Unable to execute dex: Multiple dex files define in Android [duplicate]

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.
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.
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.
[Solved for me]
Eclipse project properties->Java build path->Order and export
Uncheck Android private libraries.
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;
This problem was happening me, I had an external .jar in my libs folder called gson-2.2.2.jar but for some reason there were two of them, gson-2.2.2.jar and gson-2.2.2.jar(1), I simply deleted the latter and my project built fine again.
Close eclipse.
Delete bin folder inside your project folder.
Start eclipse and clean your project.
Now run and the problem should be gone
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
For me, I just right click on project -> Build path -> configure build path -> Libraries -> remove dependency
after it works.
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.
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.
Go to Project/properties and Java Build Path and unchecked the Android Private Libraries.
Done
I removed Android dependencies from build path and it worked.
Edit: ignore that. I had same jar in my maven dependencies and libs folder. I removed the one at the lib folder.
You have probably installed r14, this error may have been caused due to the platform tools update, you have to re-install your sdk
For me this problem only exists as long as there are Android library projects involved in my project. So when I remove all the libraries and do as you said I can run my app again.
If there are libraries involved even the bin-removal-trick trick won' work.
I don't get why this bug first appeared today since I'm using ADT 14 for several days now. Well there were other bugs that kept me happy though.
Deleting the bin folder was not enough, I also deleted the gen folder. Then after two rebuilds the dex error message was gone.
Select the project in Project Explorer, right-click and select Properties -> Java Build Path -> Source -> Check the box for Allow output folders for source folders
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
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:
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
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
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!
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.
After reading Terrys response about deleting the bin directory and Larrys about the the location of the ANT directory:
I moved the files located in my projects BIN directory to the BIN/CLASSES and im up and running.
Edit 1
Then failed on second run...doh
Edit 2
So closed Eclipse moved files back to original location and its all working... um what?
I don't pretend to know why this worked. Will update if any changes.
Edit 3
I have noted from my backups that there were indeed duplicate files in the BIN directory and BIN/CLASSES.
So the answer is: don't have files in both locations. At least for me that's what worked.
Modify your eclipse.ini file and set the maximum memory parameter to
-Xmx1024m
Then restart your computer.
It worked for me.
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)
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...
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.
Solution for me:
BACK UP YOUR CODE!
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
Navigate to your Eclipse directory and type this command:
dev1:eclipse$ ./eclipse clear
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;
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.
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.
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.
I was facing the same issue then i saw while pushing my app some jar files which were loaded twice hence multiple dex error .Just go to your project properties -> Java Build Path and try unchecking jar which is being loaded twice.
[Solved for me]
by removing the duplicate library "JAR file" then remove BuildConfig.java file, Clean project and its work.

Android: Dex conversion failed while importing

I got an error while i import an android project from one workspace location to another in eclipse.
I'm using Google_admob in my project to display ads..I does't have any errors and it works well in my old workspace.
Eclipse Version : Indigo Service Release 2
Android-Project Version : Android 4.0.3
Error states :
[2012-12-03 12:02:27 - Dex Loader] Unable to execute dex: Multiple dex files define Lcom/google/ads/Ad;
Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/google/ads/Ad;
i found my problem.
I actually import my lib jar file in libs_folder and also in project_libraries(External Jar)..So 2 times dex file has created in bin/dexedLibs/ ..Now i deleted one jar file from one location ..
now its working
Thanks for your support geeks..
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.

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

I've been searching around and there are quite a few posts relating to this issue, but there doesn't seem to be a definitive solution (eg Error when building apk - "Multiple dex files define Lcom/google/ads/Ad")
I've tried cleaning/updating/restarting eclipse - all of the things mentioned in other posts.
My project builds and I can run it on a device. But when I try and export a signed apk I get the error.
I don't get the error with other projects - all of which worked before updating adt etc but for some reason a particular project won't export...
As I say I can build the project in eclipse and run/debug it - I just can't export it.
The root cause of the problem was that one of the library was using nineoldandroid library as a jar stored in the ./libs dir , while another project was using nineoldandroid by referencing it
I was running into this issue. My situation was my application project was referencing a library project. Both were including the same external library (both use the library). Once I removed the reference to the external reference in the application project, the error went away. For me, this seemed to be that linking in the library was causing duplicate symbols, which was generating the "Multiple dex file" errors. Just a guess on my part. But, reading the above comments and other posts eventually lead me to see that I was including the library twice.
Check your build path. It is likely that you toggled 2 packages that are importing the same library (for me it was Google API that needed to be untoggled then retoggled)
in my case.. though the librari is not loaded in project.properties. it return "multiple dex bla bla bla.." I simply remove the library. and the problem solved
[Solution that worked in my case]
Right click project -> Build Path -> Configure Build Path -> Source -> Remove libCocos2dx
Was somehow building these libraries twice (since it's also included in Libraries tab)

Unable to execute dex: Multiple dex files define Lcom/myapp/R$array;

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.
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.
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.
[Solved for me]
Eclipse project properties->Java build path->Order and export
Uncheck Android private libraries.
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;
This problem was happening me, I had an external .jar in my libs folder called gson-2.2.2.jar but for some reason there were two of them, gson-2.2.2.jar and gson-2.2.2.jar(1), I simply deleted the latter and my project built fine again.
Close eclipse.
Delete bin folder inside your project folder.
Start eclipse and clean your project.
Now run and the problem should be gone
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
For me, I just right click on project -> Build path -> configure build path -> Libraries -> remove dependency
after it works.
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.
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.
Go to Project/properties and Java Build Path and unchecked the Android Private Libraries.
Done
I removed Android dependencies from build path and it worked.
Edit: ignore that. I had same jar in my maven dependencies and libs folder. I removed the one at the lib folder.
You have probably installed r14, this error may have been caused due to the platform tools update, you have to re-install your sdk
For me this problem only exists as long as there are Android library projects involved in my project. So when I remove all the libraries and do as you said I can run my app again.
If there are libraries involved even the bin-removal-trick trick won' work.
I don't get why this bug first appeared today since I'm using ADT 14 for several days now. Well there were other bugs that kept me happy though.
Deleting the bin folder was not enough, I also deleted the gen folder. Then after two rebuilds the dex error message was gone.
Select the project in Project Explorer, right-click and select Properties -> Java Build Path -> Source -> Check the box for Allow output folders for source folders
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
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:
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
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
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!
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.
After reading Terrys response about deleting the bin directory and Larrys about the the location of the ANT directory:
I moved the files located in my projects BIN directory to the BIN/CLASSES and im up and running.
Edit 1
Then failed on second run...doh
Edit 2
So closed Eclipse moved files back to original location and its all working... um what?
I don't pretend to know why this worked. Will update if any changes.
Edit 3
I have noted from my backups that there were indeed duplicate files in the BIN directory and BIN/CLASSES.
So the answer is: don't have files in both locations. At least for me that's what worked.
Modify your eclipse.ini file and set the maximum memory parameter to
-Xmx1024m
Then restart your computer.
It worked for me.
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)
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...
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.
Solution for me:
BACK UP YOUR CODE!
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
Navigate to your Eclipse directory and type this command:
dev1:eclipse$ ./eclipse clear
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;
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.
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.
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.
I was facing the same issue then i saw while pushing my app some jar files which were loaded twice hence multiple dex error .Just go to your project properties -> Java Build Path and try unchecking jar which is being loaded twice.
[Solved for me]
by removing the duplicate library "JAR file" then remove BuildConfig.java file, Clean project and its work.

Categories

Resources