In my Android application in Eclipse I get the following error.
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already add
Simply cleaning the project has worked for me every time this error has come up.
Just for the other people who still have this problem and they have tried the above answers but still getting the error (which was my case), then my solution was to delete the project from Eclipse and re-import it again.
This made the Android library to be added again to my referenced libraries, so now I have two Android JAR files referenced, hence I deleted one of them and now it compiles fine.
Solution: Delete the project from Eclipse IDE and then re-import it again, then check for the above solutions.
Ran into this problem myself today. Cleaning and rebuild did not fix the problem. Deleting and reimporting the project didn't help either.
I finally traced it back to a bad additions to my .class file. I think this was added by the plugin tools when I was trying to fix another problem, removing it got rid of the "Conversion to Dalvik format failed with error 1" build error:
<classpathentry kind="lib" path="C:/dev/repository/android-sdk-windows/platforms/android-3/android.jar">
<attributes>
<attribute name="javadoc_location" value="file:/C:/dev/repository/android-sdk-windows/docs/reference"/>
</attributes>
<accessrules>
<accessrule kind="nonaccessible" pattern="com/android/internal/**"/>
</accessrules>
I ran into this problem but my solution was twofold. 1.) I had to add an Android target version under project -> properties -> Android. 2.) I didn't have all google 'third party add-ons'. Click in AVD SDK manager under available packages -> third-party add-ons -> Google Inc. I downloaded all of the SDKs and that solved my issue.
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 the bin
directory and refreshed the project in Eclipse and the error went away!
I've dealt with this problem when using Sherlock ActionBar library in my project. You could do the following step, it's work for me.
Hope that will help you.