android - 我如何检查android中的dex计数?

标签 android android-studio dex android-multidex

我项目的gradle文件如下。

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.1"

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

在 Android Studio 中“生成签名的 APK”时,我可以看到 DexIndexOverflowException。

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

我已经知道这个错误并阅读了文档(https://developer.android.com/studio/build/multidex.html)。
只是我想检查一下超过了多少dex。

例如:

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

请找到解决方案。

最佳答案

Android Studio 有一个 APK analyzer显示此信息,不需要 gradle 插件。

关于android - 我如何检查android中的dex计数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41758284/

相关文章:

android - Android布局文件夹可以包含子文件夹吗?

android - 使用Facebook Audience Network时Android Studio错误

android - 如何在Android依赖项中添加一行?

Android Multidex 列出所有类

java - 方法和类的smali结构

java - 如何将DEX反编译成Java源代码?

android - 无法在 Android Studio 3.0.1 (Ubuntu 17.10 x64) 中使用 "Start a new Android project"

android - 获取微调器的名称值

java - 如何在 if else 语句中表达一系列整数?

android - (Android Studio)快速完成外部类的建议变量名?