Skip to content Skip to sidebar Skip to footer

Rest Android Client Using Spring And Oauth2 Error Dexarchivemergerexception: Unable To Merge Dex

I have a server running and I want to connect an android client to the server with spring's oauth2. I use Android Studio. My problem is related to the gradle configurations, which

Solution 1:

android {

dexOptions {
    preDexLibraries = false
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
packagingOptions
        {
            exclude 'AndroidManifest.xml'
            exclude 'META-INF/LICENSE'
            exclude 'META-IN F/NOTICE'
            exclude 'META-INF/DEPENDENCIES'
        }
defaultConfig {
    vectorDrawables.useSupportLibrary = true
    applicationId "com.support.project"
    minSdkVersion 14
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}

}

Try this it should work for your cause. Go through this link to understand why we should add this line of code multiDexEnabled true

Solution 2:

I finally solved the problem. There were two modules that were duplicate, so I had to exclude them from the Module build.gradle file. What I had to do was:

compile('org.springframework.android:spring-android-rest-template:2.0.0.M3') {
    exclude module: 'spring-android-core'
}

compile('org.springframework.security.oauth:spring-security-oauth2:2.3.0.RC1'){
    exclude module: 'spring-web'
}

Post a Comment for "Rest Android Client Using Spring And Oauth2 Error Dexarchivemergerexception: Unable To Merge Dex"