为什么Android Gradle preDexDebug“源和目标必须不同”构建失败?

时间:2014-07-22 11:50:44

标签: android gradle android-studio android-gradle

我有一个使用Android Studio 0.8.1构建的Android应用程序并面临此问题:

Error:Execution failed for task ':app:preDexDebug'.
> java.lang.IllegalArgumentException: Source C:\Users\mfedorov\AndroidStudioProjects\EPOS2\app\build\intermediates\pre-dexed\debug\mate-api-0.0.1-SNAPSHOT-0ef7e3259aeaf19202f545da97dc6b1ae2502c9a.jar and destination C:\Users\mfedorov.ALTIUS-PLUS\AndroidStudioProjects\EPOS2\app\build\intermediates\pre-dexed\debug\mate-api-0.0.1-SNAPSHOT-0ef7e3259aeaf19202f545da97dc6b1ae2502c9a.jar must be different

这是我的build.gradle文件内容(我已更改的部分,其余部分是默认的)

configurations.all {
    // check for updates every build
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])

    compile 'org.apache.commons:commons-collections4:4.0'
    compile 'org.slf4j:slf4j-android:1.7.7'
    compile 'com.altius.logging:logging-utils:0.0.1-SNAPSHOT'
    compile group: "com.altius.mate", name: "mate-bluetooth", version: "0.0.1-SNAPSHOT", changing: true
    compile group: "com.altius.mate", name: "mate-api", version: "0.0.1-SNAPSHOT", changing: true
    //compile('org.simpleframework:simple-xml:2.7.1') {
    //exclude group: 'stax', module: 'stax-api'
    //exclude group: 'xpp3', module: 'xpp3'
    //}

}

root build.gradle的内容是默认使用android project

创建的

mate-api-0.0.1-SNAPSHOT工件来自Maven本地存储库mavenLocal()

2 个答案:

答案 0 :(得分:57)

答案只是清理项目。我有一段时间遇到同样的问题。

  

构建 - > 清洁项目

答案 1 :(得分:0)

删除项目中的build文件夹并在android studio中使缓存无效,重新启动android studio