Why Android Gradle preDexDebug "Source and destination must be different" build failed?-ThrowExceptions

Exception or error:

I have an Android application built with Android Studio 0.8.1 and facing the issue:

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

Here’s my build.gradle file contents (the part that I have changed, the rest is default)

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'


contents of the root build.gradle are default as created with android project

mate-api-0.0.1-SNAPSHOT artifacts are from Maven local repository mavenLocal()

How to solve:

The answer was just to clean the project. I was having same problem for some time.

Build -> Clean Project


Delete the build folder in your project and invalidate cache in android studio, restart android studio

Leave a Reply

Your email address will not be published. Required fields are marked *