In my Android application in Eclipse I get the following error.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/xmlpull/v1/XmlPullParser;
....
Conversion to Dalvik format failed with error 1
This error only appears when I add a specific external JAR file to my project. I searched for a long time for the possible solution, but none of the possible solutions work. I even tried to change to Android 1.6 instead of 1.5 (the current version I use).
Just clean the project
If this does not work try the other solutions
EDIT (new solution):
It looks like the previous solution is only a bypass. I managed to finally fix the problem permanently: In my case there was a mismatch in android-support-v4 files in my project and in the Facebook project that is referenced in my project.
I found this error by performing Lint Check (Android Tools / Run Lint: Check for Common Errors)
My previous solution:
I've tried any possible solution on this site - nothing helped!!!
Finally I've found an answer here: https://groups.google.com/forum/#!topic/actionbarsherlock/drzI7pEvKd4
Easy steps:
My problem was caused by ADT version 12.0 and ProGuard integration. This bug is well documented and the solution is in the documentation
Solution is in here
ProGuard command line
I found something else. Android uses the
/libs
directory for JAR files. I have seen the "Conversion to Dalvik format failed with error 1" error numerous times, always when I made a mistake in my JAR files.Now I upgraded Roboguice to a newer version, by putting the new JAR file in the
/libs
directory and switching the class path to the new version. That caused the Dalvik error.When I removed one of the Roboguice JAR files from the
/libs
folder, the error disappeared. Apparently, Android picks up all JAR files from/libs
, regardless of which ones you specify in the Java build path. I don't remember exactly, but I think Android started using/libs
by default starting with Android 4.0 (Ice Cream Sandwich, ICS).I am using Android 1.6 and had one external JAR file. What worked for me was to remove all libraries, right-click project and select Android Tools -> *Fix Project Properties (which added back Android 1.6) and then add back the external JAR file.
If you have ADT revision 12+, you should update your proguard from 4.4 -> 4.6 (as described here). Also, you should leave ...\bin\proguard.bat file in the orginal form.
Just download it from the web, and copy lib folder from downloaded package to the :
[Android SDK Installation Directory]\tools\proguard\lib