The source and target preDex classes for Android must be different.

My project consists of two modules: a library and an actual application. If I add productFlavors to my library modules, the second time I try to run the application, I get the following error:

Execution failed for task ':app:preDexDevDebug'.

      

java.lang.IllegalArgumentException: Source / app / build / intermediates / pre-dexed / dev / debug / classes-1d938e14549827f08a7a5e52ff3458d568bf7342.jar / classes.dex and destination / app / build / intermediates / pre-dexed / dev / debug / classes 1d938e14549827f08a7a5e52ff3458d568bf7342.jar / classes.dex should be different

If I remove the following lines from the library build.gradle file everything works fine:

defaultPublishConfig "developmentDebug"
publishNonDefault true

productFlavors {
    production {
        minSdkVersion 15
    }

    development {
        minSdkVersion 22
    }
}

      

The same question was asked here . Clearing the project makes the project run the first time, but it still crashes the second time I run the app. Any ideas?

+3


source to share





All Articles