我对 Gradle 很陌生。当我做一个时,我的项目正在编译文件
./gradlew assembleDebug
但是当我尝试运行测试时它不会:
./gradlew connectedCheck
我得到(其中几个):
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lcom/facebook/AccessToken$SerializationProxyV1;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:490)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
这是我的项目的结构:
main app depends on:
compile 'com.android.support:support-v4:18.0.+'
compile 'com.android.support:gridlayout-v7:18.0.+'
compile 'com.google.code.gson:gson:1.7.2'
compile 'com.jakewharton:butterknife:2.0.1'
compile 'com.squareup.retrofit:retrofit:1.1.1'
compile 'com.squareup:otto:1.3.4'
compile 'com.squareup.okhttp:okhttp:1.2.0'
compile project(':Library:mylib')
mylib depends on:
compile 'com.android.support:support-v4:18.0.+'
compile files('libs/facebooksdk.jar')
compile files('libs/libGoogleAnalyticsV2.jar')
在此行之后,来自 mylib 的每个 jar 都会出现异常:
:Library:mylib:dexTest
任何想法?