Unable to execute dex: Multiple dex files define Lorg/apache/maven/artifact/Artifact

情到浓时终转凉″ 提交于 2019-12-24 13:29:53

问题


I have an Android project with Robolectric.

My application related classes are placed in src/main/java and test related classes in src/test/java.

I have these test dependencies in my 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>

When building and deploying from console with mvn package android:deploy everything is ok. Problem occurs when launching project from 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;

It appears that dependencies that are required for Robolectric only are included. What am I doing wrong?


回答1:


in the folder bin/dexedlibs you have a duplicate jar

  1. remove it
  2. make a clean of preject
  3. retry



回答2:


After some investigation it appears to be a m2e-android related issue




回答3:


I once encountered same error. At the end, I found it is caused by including MoPubView's jar twice:

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

I deleted the latter. It is solved.



来源:https://stackoverflow.com/questions/15597371/unable-to-execute-dex-multiple-dex-files-define-lorg-apache-maven-artifact-arti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!