Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:Build-in class shrinker and multidex are not supported yet

After adding useProguard true and multidexEnabled true to my built types this error comes up when trying to build:

Error:Build-in class shrinker and multidex are not supported yet.

compileSdkVersion 23
buildToolsVersion '23.0.2'
defaultConfig {
    applicationId "com.example.android
    minSdkVersion 16
    targetSdkVersion 23
    versionCode gitVersionCode()
    versionName gitVersionName()
    multiDexEnabled true
}

buildTypes {
    debug {
        ...
        useProguard false
        debuggable true
    }
    release {
        ...
        useProguard true
    }

Running Android Studio 2.0 Beta 5.

Any solution besides removing multidex?

like image 687
Jonas Borggren Avatar asked Feb 25 '16 12:02

Jonas Borggren


2 Answers

useProguard became minifyEnabled. Try the following:

android {
    buildTypes {
        release {
            minifyEnabled true
            shrinkResources true
        }
    }
}
like image 160
Ugurcan Yildirim Avatar answered Nov 03 '22 13:11

Ugurcan Yildirim


Just in case someone is still looking into this. First of all, try to avoid the 64k limit (and avoid using multiDexEnabled) by enable code shrinking. Try the following:

android {
    ...
    buildTypes {
        release {
            shrinkResources true
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                'proguard-rules.pro'
        }
    }
}

If the above doesn't work and you have to use miltiDexEnabled then don't use proguard and don't try to shrink resources. Try the following:

buildTypes {
    ...
    release {
        minifyEnabled false
        ...
    }
}
like image 34
jonnyn Avatar answered Nov 03 '22 13:11

jonnyn