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

前端 未结 30 2436
抹茶落季
抹茶落季 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:48

    Updating Proguard to latest version solved it for me.

    • My proguard path was C:\Program Files (x86)\Android\android-sdk\tools\proguard\
    • I downloaded the new version from here
    • and replaced both bin and lib folders

    THANK GOD!

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

    Just clean the project

    If this does not work try the other solutions

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

    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:

    Go to Project -> uncheck Build Automatically

    Go to Project -> Clean... , clean both the library project and your app project

    Export your app as a signed APK while Build Automatically is still disabled

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

    Go to Project and then uncheck "Build Automatically".Then try to export the project and the error is gone.

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

    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).

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

    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:

        <dependency>
            <groupId>com.globalmentor</groupId>
            <artifactId>globalmentor-core</artifactId>
            <version>1.0-SNAPSHOT</version>
            <!-- android-maven-plugin can't seem to automatically keep this from being
                 included twice; it must therefore be included manually (either explicitly
                 or transitively) in dependent projects -->
            <scope>provided</scope>
        </dependency>
    

    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:

        <!-- android-maven-plugin can't seem to automatically keep this from being
            included twice -->
        <!-- <dependency> -->
        <!-- <groupId>com.globalmentor</groupId> -->
        <!-- <artifactId>globalmentor-core</artifactId> -->
        <!-- <version>1.0-SNAPSHOT</version> -->
        <!-- </dependency> -->
    
        <dependency>
            <groupId>com.globalmentor</groupId>
            <artifactId>globalmentor-google</artifactId>
            <version>1.0-SNAPSHOT</version>
            <exclusions>
                <!-- android-maven-plugin can't seem to automatically keep this from
                    being included twice -->
                <exclusion>
                    <groupId>com.globalmentor</groupId>
                    <artifactId>globalmentor-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    
        <dependency>
            <groupId>com.globalmentor</groupId>
            <artifactId>globalmentor-android</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    
    0 讨论(0)
提交回复
热议问题