【问题标题】:Unable to execute dex: Multiple dex files define Lorg/apache/maven/artifact/Artifact无法执行dex:多个dex文件定义了Lorg/apache/maven/artifact/Artifact
【发布时间】:2013-03-24 10:30:11
【问题描述】:

我有一个使用 Robolectric 的 Android 项目。

我的应用相关类放在src/main/java,测试相关类放在src/test/java

我的 pom.xml 中有这些测试依赖项

        <dependency>
            <groupId>org.robolectric</groupId>
            <artifactId>robolectric</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

使用mvn package android:deploy 从控制台构建和部署时,一切正常。 从 Eclipse (Juno) 启动项目时出现问题。

[2013-03-24 12:27:26 - Dex Loader] Unable to execute dex: Multiple dex files define Lorg/apache/maven/artifact/Artifact;
[2013-03-24 12:27:26 - my-app] Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lorg/apache/maven/artifact/Artifact;

似乎仅包含 Robolectric 所需的依赖项。我做错了什么?

【问题讨论】:

    标签: android robolectric android-annotations


    【解决方案1】:

    在文件夹 bin/dexedlibs 中有一个重复的 jar

    1. 删除它
    2. 清理项目
    3. 重试

    【讨论】:

    • 事实并非如此。 bin/dexedLibs 包含所有依赖项。即使是测试所需的这些。如maven-project、maven-profile、wagon-file等。我如何让他们远离那里?
    【解决方案2】:

    经过一番调查,它似乎是与 m2e-android 相关的issue

    【讨论】:

      【解决方案3】:

      我曾经遇到过同样的错误。最后发现是两次包含MoPubView的jar造成的:

      - On the one hand, I imported the MoPubView project via Eclipse Menu function "File | Import";  
      
       -> then right click my project, select "Properties"; 
       -> In the left bar, select "android";
       -> In the "Library" section at the right, press [Add] button...  
      
      - On the other hand, I copied the mopub-sdk.jar to the /libs folder of my project. 
      

      我删除了后者。解决了。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-01-12
        • 1970-01-01
        • 2015-02-17
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-03-14
        相关资源
        最近更新 更多