0
所以我知道,描述了簡單的情況下,錯誤當你包括JUnit 4.10頁面:java.lang.IllegalArgumentException:已添加:Lorg/hamcrest/BaseDescription;
不幸的是,我使用的是依賴於JUnit的庫:
COM .googlecode.json-simple:json-simple:jar:1.1.1
所以我不能添加排除。這裏是依賴關係樹:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ androidapp ---
[INFO] com.mycompany:androidapp:apk:0.1
[INFO] +- com.google.android:android:jar:2.3.3:provided
[INFO] | +- commons-logging:commons-logging:jar:1.1.1:provided
[INFO] | +- org.apache.httpcomponents:httpclient:jar:4.0.1:provided
[INFO] | | \- org.apache.httpcomponents:httpcore:jar:4.0.1:provided
[INFO] | +- org.khronos:opengl-api:jar:gl1.1-android-2.1_r1:provided
[INFO] | +- xerces:xmlParserAPIs:jar:2.6.2:provided
[INFO] | +- xpp3:xpp3:jar:1.1.4c:provided
[INFO] | \- org.json:json:jar:20080701:provided
[INFO] +- com.google.android:support-v4:jar:r7:compile
[INFO] \- com.mycompany:api-client-java:jar:1.0:compile
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] | \- junit:junit:jar:4.10:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:compile
[INFO] +- commons-io:commons-io:jar:2.4:compile
[INFO] +- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.6:compile
[INFO] +- ch.qos.logback:logback-core:jar:1.1.1:compile
[INFO] \- ch.qos.logback:logback-classic:jar:1.1.1:compile
這裏是Maven的錯誤:
[INFO]
[INFO] UNEXPECTED TOP-LEVEL EXCEPTION:
[INFO] java.lang.IllegalArgumentException: already added: Lorg/hamcrest/BaseDescription;
[INFO] at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
[INFO] at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
[INFO] at com.android.dx.command.dexer.Main.processClass(Main.java:685)
[INFO] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
[INFO] at com.android.dx.command.dexer.Main.access$600(Main.java:78)
[INFO] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
[INFO] at com.android.dx.command.dexer.Main.processOne(Main.java:596)
[INFO] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
[INFO] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
[INFO] at com.android.dx.command.dexer.Main.run(Main.java:230)
[INFO] at com.android.dx.command.dexer.Main.main(Main.java:199)
[INFO] at com.android.dx.command.Main.main(Main.java:103)
我能做些什麼來避免這個問題?