【发布时间】:2017-04-05 10:11:40
【问题描述】:
我的应用程序中的 multidex 支持出现了一些问题,实际上应用程序安装正常,但在此过程中,一些活动崩溃了,应用程序重新启动了主要活动。在 logcat 中我发现了这个:
I/MultiDex: install
I/MultiDex: VM has multidex support, MultiDex support library is disabled.
但我遵循了启用 Multidex 支持的建议:
分级:
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "com..company.package"
minSdkVersion 15
targetSdkVersion 25
multiDexEnabled true
versionCode 21
versionName "2.1.3"
}
dexOptions {
javaMaxHeapSize "4g"
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//compile project(':rangebar')
compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') { transitive = true }
compile('com.weiwangcn.betterspinner:library-material:1.1.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile files('libs/itextpdf-5.5.9.jar')
compile 'com.android.support:multidex:1.0.1'
...
应用程序类扩展了 Multidex:
public class MyApplication extends MultiDexApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
我不知道我究竟缺少什么来摆脱这件事
提前致谢。
【问题讨论】:
-
你要么在 attachBaseContext 方法中使用 multidex 安装,要么使用两者扩展 MultidexApplication 都是没有意义的,因为两者都做同样的事情
-
@M.Ashish 是的,谢谢,成功了