我已经谷歌搜索找到了解决方案,但我已经尝试了所有方法,其中任何一个都有效。首先我的项目适用于任何问题,后来我添加了一些更改,这发生了。当我删除所有更改时,问题并没有消失。当我尝试编译项目时,gradle控制台显示:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/home/user/Android/Sdk/build-tools/22.0.0/dx --dex --no-optimize --output /home/projectpath/app/build/intermediates/dex/debug --input-list=/home/projectpath/app/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
意外的顶级例外情况: com.android.dex.DexException:多个dex文件定义Lbolts / AggregateException; 在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) 在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) 在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) 在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) 在com.android.dx.merge.DexMerger.merge(DexMerger.java:189) 在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454) 在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303) 在com.android.dx.command.dexer.Main.run(Main.java:246) 在com.android.dx.command.dexer.Main.main(Main.java:215) 在com.android.dx.command.Main.main(Main.java:106)
这是我的build.gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
defaultConfig {
applicationId "application.com.name"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:palette-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.android.support:cardview-v7:22.0.+'
compile 'com.jakewharton:butterknife:5.1.2'
compile 'com.jakewharton.timber:timber:2.5.0'
compile 'fr.tvbarthel.lib.blurdialogfragment:lib:1.1.0@aar'
compile 'com.github.chenupt.android:multiplemodel:1.1.0@aar'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.google.guava:guava:18.0'
compile 'com.jpardogo.materialtabstrip:library:1.0.8'
compile 'com.getbase:floatingactionbutton:1.7.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.facebook.android:facebook-android-sdk:3.21.1'
}
dependencies {
compile 'com.parse.bolts:bolts-android:1.+'
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
compile fileTree(dir: 'libs', include: 'ParseCrashReporting-*.jar')
}