我的项目运行得非常好。
我添加谷歌分析后,它不允许.dex
文件中的64k,我已经设置:
defaultConfig {
multiDexEnabled true
}
但是它有以下错误
:MainEntry:transformClassesWithMultidexlistForDebug FAILED 错误:任务':MainEntry:transformClassesWithMultidexlistForDebug'的执行失败。 java.io.IOException:无法读取[C:\ Users \ temp2 \ android-git \ MainEntry \ build \ intermediates \ transforms \ jarMerging \ debug \ jars \ 1 \ 1f \ combined.jar](无法处理类[com / vtcpay / a / a.class](堆栈映射框中的未知验证类型[143]))
答案 0 :(得分:1)
确保启用了multidex输出,如以下代码段所示:
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
确保在清单中将multiDexApplication类从multidex支持库添加到应用程序元素
...
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
有关详细信息,请参阅Reference
答案 1 :(得分:1)
谢谢大家 我已经找到了解决这个问题的方法。我应该在默认配置下添加此脚本。
multidex配置需要显着增加构建处理时间,因为构建系统必须做出关于主DEX文件中必须包含哪些类以及辅助DEX文件中可包含哪些类的复杂决策。这意味着使用multidex作为开发过程的一部分执行的例行构建通常需要更长时间,并且可能会减慢您的开发过程。
productFlavors {
// Define separate dev and prod product flavors.
dev {
// dev utilizes minSDKVersion = 21 to allow the Android gradle plugin
// to pre-dex each module and produce an APK that can be tested on
// Android Lollipop without time consuming dex merging processes.
minSdkVersion 21
}
prod {
// The actual minSdkVersion for the application.
minSdkVersion 14
}
}