Jose Ivan
Jose Ivan

Reputation: 111

VM has multidex support, MultiDex support library is disabled. issue

I already have tried all the solutions that are in internet but any of them works, this is my gradle:

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.0'

defaultConfig {
    applicationId "com.rocketjourney"
    minSdkVersion 21
    targetSdkVersion 24
    versionCode 68
    versionName "4.41"
    multiDexEnabled true
    vectorDrawables.useSupportLibrary = true
    testInstrumentationRunner "com.rocketjourney.helpers.CustomTestRunner"
}

configurations.all {
    resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    resolutionStrategy.force 'com.squareup.okio:okio:1.13.0'
    resolutionStrategy.force 'com.squareup.okhttp3:okhttp:3.8.0'
}

dexOptions {
    javaMaxHeapSize "4g"
    jumboMode = true
}`

repositories {
    mavenCentral()
    maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
    maven { url "https://jitpack.io" }
    flatDir { dirs 'libs' }
    flatDir { dirs '../aars' }
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    compile('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') { transitive = true; }
    etc...
}`

my manifest looks like this:

<application
    android:name="com.rocketjourney.RJApplication"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"

In my RJApplication.class I have this code:

public class RJApplication extends Application {

  @Override
  protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
  }

But my error now is this:

11-08 11:54:36.494 5743-5743/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.rocketjourney, PID: 5743 java.lang.NoClassDefFoundError: Failed resolution of: Lio/fabric/sdk/android/services/common/FirebaseInfo; at com.crashlytics.android.CrashlyticsInitProvider.onCreate(CrashlyticsInitProvider.java:22) at android.content.ContentProvider.attachInfo(ContentProvider.java:1696) at android.content.ContentProvider.attachInfo(ContentProvider.java:1671) at android.app.ActivityThread.installProvider(ActivityThread.java:4999) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) Caused by: java.lang.ClassNotFoundException: Didn't find class "io.fabric.sdk.android.services.common.FirebaseInfo" on path: DexPathList[[zip file "/data/app/com.rocketjourney-2/base.apk"],nativeLibraryDirectories=[/data/app/com.rocketjourney-2/lib/x86, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:511) at java.lang.ClassLoader.loadClass(ClassLoader.java:469) at com.crashlytics.android.CrashlyticsInitProvider.onCreate(CrashlyticsInitProvider.java:22)  at android.content.ContentProvider.attachInfo(ContentProvider.java:1696)  at android.content.ContentProvider.attachInfo(ContentProvider.java:1671)  at android.app.ActivityThread.installProvider(ActivityThread.java:4999)  at android.app.ActivityThread.installContentProviders(ActivityThread.java:4594)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4534)  at android.app.ActivityThread.access$1500(ActivityThread.java:151)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1364)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:135)  at android.app.ActivityThread.main(ActivityThread.java:5254)  at java.lang.reflect.Method.invoke(Native Method)  at java.lang.reflect.Method.invoke(Method.java:372)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)  Suppressed: java.lang.ClassNotFoundException: io.fabric.sdk.android.services.common.FirebaseInfo at java.lang.Class.classForName(Native Method) at java.lang.BootClassLoader.findClass(ClassLoader.java:781) at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) at java.lang.ClassLoader.loadClass(ClassLoader.java:504) ... 16 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Hope you guys can help me, I will appreciate it so much!

Upvotes: 2

Views: 5181

Answers (1)

ישו אוהב אותך
ישו אוהב אותך

Reputation: 29783

You don't need to add multidex support if your minSdkVersion is 21.

From the documentation:

Multidex support for Android 5.0 and higher

Android 5.0 (API level 21) and higher uses a runtime called ART which natively supports loading multiple DEX files from APK files. ART performs pre-compilation at app install time which scans for classesN.dex files and compiles them into a single .oat file for execution by the Android device. Therefore, if your minSdkVersion is 21 or higher, you do not need the multidex support library.

So, you need to remove compile 'com.android.support:multidex:1.0.1' from your build.gradle. Then you need to extend your RJApplication with Application. Also remove MultiDex.install(this); from your attachBaseContext().

all you need to do is set multiDexEnabled to true by adding multiDexEnabled true. Please refer to Configure your app for multidex

Upvotes: 4

Related Questions