Android 生成APK时出错,这是一个异常
我试图在Android Studio中构建APK,但它显示错误消息是错误的Android 生成APK时出错,这是一个异常,android,Android,我试图在Android Studio中构建APK,但它显示错误消息是错误的 Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
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
我可以在其他应用程序中成功构建apk,所以我不知道为什么会出现此消息
有人能教我如何解决这个问题吗
您需要在gradle中启用
multiDex
:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
要了解此问题的更多原因,请阅读此您需要在gradle中启用
多索引
:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
要了解此问题的更多原因,请阅读此只需在build.gradle中添加以下行:
android {
defaultConfig {
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
在你的舱单上
<application
<meta-data android:name="android.support.multidex.MultiDexApplication">
</application>
只需在build.gradle中添加以下行:
android {
defaultConfig {
multiDexEnabled true
}
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
在你的舱单上
<application
<meta-data android:name="android.support.multidex.MultiDexApplication">
</application>
亲爱的各位:这类问题已经在这里提出了。请添加评论而不是回答亲爱的所有人:这类问题已经在这里提出了。请添加评论而不是回答谢谢@Mayura Devani,我得到了解决方案。谢谢@Mayura Devani,我得到了解决方案。谢谢@OBX,它为我节省了很多。谢谢@OBX,它为我节省了很多。