“Conversion to Dalvik format failed with error 1” on external JAR

前端 未结 30 2403
抹茶落季
抹茶落季 2020-11-21 07:32

In my Android application in Eclipse I get the following error.

UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already add

相关标签:
30条回答
  • 2020-11-21 07:42

    Simply cleaning the project has worked for me every time this error has come up.

    0 讨论(0)
  • 2020-11-21 07:43

    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.

    0 讨论(0)
  • 2020-11-21 07:43

    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>
    

    0 讨论(0)
  • 2020-11-21 07:43

    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.

    0 讨论(0)
  • 2020-11-21 07:44

    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!

    0 讨论(0)
  • 2020-11-21 07:48

    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.

    1. Right click to your project, select properties.
    2. A dialog will show up, select 'Java build path' on the left menu.
    3. Remove 'Android dependencies' and 'Android private libraries' on the right panel then click OK
    4. Clean your project (select menu Project --> Clean)
    5. Right click your project, select Android Tools -> Fix project properties
    6. Clean project once again.
    7. Restart your computer
    8. Open eclipse and Export apk

    Hope that will help you.

    0 讨论(0)
提交回复
热议问题