Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I check the dex count in android?

My project's gradle file is as below.

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.1"

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt')
        }
    }
}

I can see DexIndexOverflowException when "Generate Signed APK" in Android Studio.

Error:Execution failed for task ':MyProject:transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: 
com.android.ide.common.process.ProcessException: 
java.util.concurrent.ExecutionException: 
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

I already know this error and read the document(https://developer.android.com/studio/build/multidex.html).
Just I want to check How many dex has exceeded.

For example:

trouble writing output:
Too many field references: 99999; max is 65536.
You may try using --multi-dex option.

Please find a solution.

like image 592
SaeHyun Kim Avatar asked Jan 20 '17 07:01

SaeHyun Kim


3 Answers

Android Studio has an APK analyzer that shows this information, no gradle plugins required.

like image 144
Karakuri Avatar answered Nov 13 '22 10:11

Karakuri


use this plugin to get the number of method references in your APK on every build.

dexcount

like image 1
sivaBE35 Avatar answered Nov 13 '22 09:11

sivaBE35


Take a look at this. I was searching for the same and found my answer here. Basicly, you have to generate the APK of your project and then go to Build->Analyze APK and at the rasults click on classes.dex, then, below you will see exactly how many methods are defined and referenced by the project.

like image 1
Manolee Avatar answered Nov 13 '22 08:11

Manolee