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).
Often for me, cleaning the project DOES NOT fix this problem.
But closing the project in Eclipse and then re-opening it does seem to fix it in those cases...
Updating Proguard to latest version solved it for me.
C:\Program Files (x86)\Android\android-sdk\tools\proguard\
THANK GOD!
Here's another scenario, and solution:
If you run into this problem recently after updating the ADT for Eclipse:
It seems the reason is that some previous version of ADT linked Library project source folders to the "child" projects, and the current ADT/Dex combination isn't compatible with that solution anymore.
EDIT: this is confirmed by an Android Dev Blog entry, specifically this one - see the 8th paragraph onwards.
In my case the problem is actually with OpenFeint API project. I have added OpenFeint as library project:
.
It is also added into build path, ADT tools 16 gives error with this sceneario.
Right click on your project and click build path, configure the build path and then see the image and remove your project OpenFeint from here and all is done :)
None of the listed solutions worked for me.
Here's where I was having a problem:
I added the jSoup external JAR file to my project's path by first putting it in a source folder called "libs", and then right clicking on it, Build Path -> add to build path. This threw the Dalvik conversion error. It said I had "already included" a class from that JAR file. I looked around the project's directory and found that the place where it was "already included" was in fact the
bin
directory. I deleted the JAR file from thebin
directory and refreshed the project in Eclipse and the error went away!I had the same problem and none of these solutions worked. Finally, I saw in the console that the error was due to duplicated class (one in the existing project, one in the added jar file) :
So check if you are adding jar with duplicated classes in your project. If yes, try removing one of them.
It worked for me.