Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Multidex support library is disabled

I'm experiencing some problem with multidex support in my app, in fact the app install normally, but through the process, some activities crashed and the app, relaunches the main activity. In logcat I found this :

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

But I followed recommendations to enable Multidex support :

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'
...

Application class extends Multidex :

public class MyApplication extends MultiDexApplication {
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    MultiDex.install(this);
}
}

I don't know what I am exactly missing to get rid of this matter

Thanks in advance.

like image 993
Houssem Avatar asked Apr 05 '17 10:04

Houssem


People also ask

How do I enable multidex?

To enable Multidex, edit the build. gradle file at the module level: android { compileSdk 31 defaultConfig { ... minSdk 21 targetSdk 31 versionCode 1 versionName "1.0" multiDexEnabled true // Add this to enable Multidex testInstrumentationRunner "androidx.

What is multidex support?

In Android, the compilers convert your source code into DEX files. This DEX file contains the compiled code used to run the app. But there is a limitation with the DEX file. The DEX file limits the total number of methods that can be referenced within a single DEX file to 64K i.e. 65,536 methods.


1 Answers

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

You should set

public class MyApplication extends Application {

Manifest

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

Then Clean-Rebuild-Run .

like image 138
IntelliJ Amiya Avatar answered Oct 06 '22 16:10

IntelliJ Amiya