Android Studio Gradle Error: Multiple Dex Files Define

Android Studio build error - Multiple dex files define Landroid/support/v4/

For anyone who is interested, I solved my own problem. My mistake was that I had pasted android-support-v4.jar and google-play-services.jar in all of my project's module lib folders (my project consists of 3 modules). What I had to do instead was to paste these jars only into my main module's lib folder, and the other modules would automatically reference them.

Android Studio Gradle Error: Multiple dex files define

In your build.gradle file try adding the following block inside your android block.

dexOptions {
preDexLibraries = false
}

DexException Multiple dex files define in Android

By simply declaring multiDexEnabled true in module-level build.gradle, works only if your minSdkVersion is set to 21 or higher.

If your minSdkVersion is lower than 21, in addition to the above step, you need to have the multidex support library as a dependency

dependencies {
compile 'com.android.support:multidex:1.0.1'
}

You can read the details are here - https://developer.android.com/studio/build/multidex.html



Related Topics



Leave a reply



Submit