我在执行我的Android应用程序时遇到此错误(我清理它然后构建它,但错误仍然存在)
错误:任务执行失败':app:dexDebug'.com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\ Program Files\Java\jdk1.7.0 _25\bin\java.exe''以非零退出值2结束
我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.rzr.rzevallosr.miappdepruebas"
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// This library handles authentication and authorization
compile 'com.spotify.sdk:spotify-auth:1.0.0-beta9@aar'
// This library handles music playback
compile 'com.spotify.sdk:spotify-player:1.0.0-beta9@aar' …Run Code Online (Sandbox Code Playgroud) 在您声明重复之前,请阅读问题.
只有最新版本的构建工具才会出现这种情况.旧版本不显示此问题.我已经尝试过在其他问题上提供的解决方案,用于多种定义@AnimRes.到目前为止没有任何帮助,这就是我发布一个新问题的原因.相同症状,不同原因,不同解决方案.
我可以在使用buildToolsVersion 22.0.1时构建没有问题,但是当我切换到buildToolsVersion 23构建失败时出错
意外的顶级异常:com.android.dex.DexException:多个dex文件定义Landroid/support/annotation/AnimRes; 在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在com.android.dx.command.dexer.Main(Main.java:502)在com.android.dx.command.dexer.Main.runMonoDex(Main.java:334).运行(Main.java:277)在com.android.dx.command.dexer.Main.main(Main.java:245)在com.android.dx.command.Main.main(Main.java:
这是我的依赖项列表:
provided 'org.projectlombok:lombok:1.16.4'
compile 'com.android.support:support-v4:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-v13:23.0.0'
compile 'com.android.support:cardview-v7:23.0.0'
compile 'com.android.support:palette-v7:23.0.0'
compile 'com.google.code.findbugs:jsr305:2.0.1'
compile 'com.google.guava:guava:18.0'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-io:commons-io:2.4'
compile 'commons-codec:commons-codec:1.10'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.squareup:otto:1.3.8'
compile 'org.jsoup:jsoup:1.7.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.squareup.okio:okio:1.5.0'
compile 'com.flaviofaria:kenburnsview:1.0.6'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.getbase:floatingactionbutton:1.10.0'
compile 'com.nispok:snackbar:2.10.10'
compile 'com.github.ksoichiro:android-observablescrollview:1.5.2'
compile 'in.srain.cube:grid-view-with-header-footer:1.0.12'
compile 'de.hdodenhof:circleimageview:1.3.0'
Run Code Online (Sandbox Code Playgroud)
为了确保每个人(包括Espresso)使用相同版本的support-annotations我在我的构建文件中有以下内容:
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:23.0.0'
} …Run Code Online (Sandbox Code Playgroud)