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).
In my case
project->properties->java build path -> in order and export tab -> uncheck android-support-v4.jar
I ran into this problem because the Android-Maven-plugin in Eclipse was apparently not recognizing transitive references and references referenced twice from a couple of projects (including an Android library project), and including them more than once. I had to use hocus-pocus to get everything included only once, even though Maven is supposed to take care of all this.
For example, I had a core library globalmentor-core, that was also used by globalmentor-google and globalmentor-android (the latter of which is an Android library). In the globalmentor-android
pom.xml
I had to mark the dependency as "provided" as well as excluded from other libraries in which it was transitively included:Then in the final application
pom.xml
I had to use the right trickery to allow only one inclusion path---as well as not explicitly including the core library:I solved the problem.
This is a JAR file conflict.
It seems that I have two JAR files on my buildpath that include the same package and classes.
smack.jar
andandroid_maps_lib-1.0.2
Deleting this package from one of the JAR files solved the problem.
For me, an extra JAR reference had appeared in my build path. I deleted this, and it works now.
All the solutions above didn't work for me. I'm not using any precompiled .jar. I'm using the LVL and the Dalvik errors where all related to the market licensing library.
The problem got solved by deleting the main project and reimporting (create a new project from existing sources).
Go to Project and then uncheck "Build Automatically".Then try to export the project and the error is gone.