always prints counts of field and method. (modified version of original dx.jar)
You can see method references of classes.dex on "Build - Analyze APK" menu in Android Studio.
But if your build fails, there is no APK. You can't use APK analyzer anymore.
If you don't want to use MultiDex
and you want to know how many methods are to be removed for build success, dx for method counting
will be more helpful.
... ... :app:compileDevDebugJavaWithJavac :app:compileDevDebugNdk UP-TO-DATE :app:compileDevDebugSources :app:transformClassesWithDexForDevDebug string ID count: 91,857 type ID count: 12,636 proto ID count: 18,417 field ID count: 72,011 (max:65535 +6476) method ID count: 81,181 (max:65535 +15646) Error converting bytecode to dex: Cause: com.android.dex.DexIndexOverflowException: Too many field references: 72011; max is: 65535. UNEXPECTED TOP-LEVEL EXCEPTION: ... ...
- Backup your original dx.jar (.../Android/sdk/build-tools/[buildToolsVersion]/lib/dx.jar)
- Replace your dx.jar with this dx.jar(see releases).
- Disable dexInProcess option.
// file: app/build.gradle
android {
dexOptions {
dexInProcess false
}
...