Make This Tech Work (Archive)

View class variables while Debugging in Android Studio with minifyEnabled true

2019-06-06 12:50:44

Android Studio About dialog

Recently I suddenly could not see class scoped variables in Android Studio (version 3.4.1). This turned out to be because I had enabled minifyEnabled in the app build.gradle file. And minifyEnabled was set to true because I was receiving a build error: Error: null, Cannot fit requested classes in a single dex file (# methods: 98727 > 65536).

Quick answer to this solution: enable multidex in your debug section in your build.gradle file as follows:

buildTypes {
    
    debug {
        minifyEnabled false
        useProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        multiDexEnabled = true
    }
}