Android Multidex 支持库被禁用

标签 android android-multidex

我在我的应用程序中遇到了 multidex 支持的问题,实际上应用程序安装正常,但在此过程中,一些 Activity 崩溃了,应用程序重新启动了主要 Activity 。在 logcat 中我发现了这个:

I/MultiDex: install
I/MultiDex: VM has multidex support, MultiDex support library is disabled.

但我遵循了启用 Multidex 支持的建议:

Gradle :

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);
}
}

我不知道摆脱这件事我到底缺少什么

提前致谢。

最佳答案

I/MultiDex: install I/MultiDex: VM has multidex support, MultiDex support library is disabled.

你应该设置

public class MyApplication extends Application {

list

<application
    android:name=".MyApplication"
   ....>

然后清理-重建-运行

关于Android Multidex 支持库被禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43228160/

相关文章:

android - 尝试在我的应用程序中创建塞子

android - Android Studio Multi-dex Gradle无法在Mac上识别Java

android - 找不到 com.androidx.multidex :multidex:2. 0.1

android - 面对 Dex 65K 方法限制错误

android - 估计信标安全

android - 具有焦点的 WebView 控件阻止 Android 5 中的媒体按钮事件

c# - 在初始化期间调用异步方法时 MvvmCross UI 卡住

android - 从 JSON 对象中读取整数或字符串数​​组

android - 在 Android 中启用 MultiDex 支持以在 Eclipse 中实现 65K+ 方法

android - Java.lang.ClassCastException : Android. support.v7.widget.ContentFrameLayout 无法转换为Android.support.v7.widget.ContentFrameLayout