从今天早上起我尝试在android studio中管理gradle中的错误,但我无法解决它。
这是错误:
Gradle tasks [:app:assembleDebug]
UNEXPECTED TOP-LEVEL EXCEPTION:
1 error
0 warnings
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\AndroidIDES\sdk\build-tools\19.0.1\dx.bat --dex --output C:\PMSL\Patovideos\app\build\dex\debug C:\PMSL\Patovideos\app\build\classes\debug C:\PMSL\Patovideos\app\build\dependency-cache\debug C:\PMSL\Patovideos\app\build\pre-dexed\debug\classes-d5d5a5f0ee3aa349db97373276cdf4ce1d756400.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\support-v4-19.0.1-4d62c5c6d8c8b8a26f02df44b7278821a9f5af4b.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-a1273e57a1a8b916291dfb13a6906d801ad6594f.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-javadoc-a86f634bf1d1005314ba37126bfafdad8f979c7c.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-sources-c2bc28216be226462ec688d3a3cc65fb947e01c5.jar C:\PMSL\Patovideos\app\build\pre-dexed\debug\universal-image-loader-1.9.1-with-sources-699e086d09eb3ee375070763bee8e42cdcacabc4.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/nostra13/universalimageloader/cache/disc/DiscCacheAware;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
这是build.gradle
apply plugin: 'android'
android {
compileSdkVersion 18
buildToolsVersion '19.0.1'
defaultConfig {
minSdkVersion 10
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.1'
compile 'com.android.support:appcompat-v7:19.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
错误在哪里?请帮帮我...我正在撕扯我的头发
答案 0 :(得分:1)
该错误意味着它正在尝试在您的APK构建时将两次类com.nostra13.universamimateloader.cache.disc.DiscCacheAware
包含在其中。我不确定这堂课的来源;如果它是你的来源中的东西,请确保你没有在那里两次以某种方式。如果它是一个库依赖项,那么你的 libs 文件夹中可能有两个包含这个类的jar - 查看它们并确保你没有在某个地方加倍。
如果您一直在更改依赖项和库,那么构建可能处于错误状态,并且执行清理和重建将修复它。这可能不太可能成为问题,但尝试这是一件很快的事。