web-dev-qa-db-fra.com

java.lang.NoClassDefFoundError: Echec de la résolution de: Landroid/support/v4/util/ArrayMap;

Aujourd'hui, j'ai trouvé cette erreur en essayant d'exécuter mon application. J'ai fait les tentatives suivantes pour le résoudre. - D'abord, j'ai supprimé le support multidex, mais je peux toujours voir les tranches d'apk là-bas. -i a également tenté de reconstruire l'intégralité du projet et mis à jour les bibliothèques de services d'assistance Android et de lecture les plus récentes, comme recommandé par Java.lang.NoClassDefFoundError: Echec de la résolution de: Landroid/support/v4/util/ArrayMap

Android Studio - NoClassDefFoundError: Echec de la résolution de Landroid/support/v4/print/PrintHelper

Java.lang.NoClassDefFoundError: Echec de la résolution de: Landroid/support/v4/os/BuildCompat .

NoClassDefFoundError: Android.support.v4.util.ArrayMap

Le stacktrace est comme suit

Java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap;
at com.google.firebase.FirebaseApp.
<clinit>
(Unknown Source)
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1751)
at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1726)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at Android.app.ActivityThread.installProvider(ActivityThread.Java:5324)
at Android.app.ActivityThread.installContentProviders(ActivityThread.Java:4898)
at Android.app.ActivityThread.handleBindApplication(ActivityThread.Java:4838)
at Android.app.ActivityThread.access$1500(ActivityThread.Java:178)
at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1536)
at Android.os.Handler.dispatchMessage(Handler.Java:111)
at Android.os.Looper.loop(Looper.Java:194)
at Android.app.ActivityThread.main(ActivityThread.Java:5636)
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:959)
at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:754)
Caused by: Java.lang.ClassNotFoundException: Didn't find class "Android.support.v4.util.ArrayMap" on path: DexPathList[[Zip file "/data/app/pinnacle.org.rider-1/base.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_dependencies_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_0_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_1_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_2_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_3_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_4_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_5_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_6_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_7_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_8_apk.apk", Zip file "/data/app/pinnacle.org.rider-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/pinnacle.org.rider-1/lib/arm, /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.google.firebase.FirebaseApp.
<clinit>
(Unknown Source) 
at com.google.firebase.FirebaseApp.initializeApp(Unknown Source) 
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source) 
at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1751) 
at Android.content.ContentProvider.attachInfo(ContentProvider.Java:1726) 
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source) 
at Android.app.ActivityThread.installProvider(ActivityThread.Java:5324) 
at Android.app.ActivityThread.installContentProviders(ActivityThread.Java:4898) 
at Android.app.ActivityThread.handleBindApplication(ActivityThread.Java:4838) 
at Android.app.ActivityThread.access$1500(ActivityThread.Java:178) 
at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1536) 
at Android.os.Handler.dispatchMessage(Handler.Java:111) 
at Android.os.Looper.loop(Looper.Java:194) 
at Android.app.ActivityThread.main(ActivityThread.Java:5636) 
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:959) 
at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:754) 
Suppressed: Java.lang.ClassNotFoundException: Android.support.v4.util.ArrayMap
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)
... 19 more
Caused by: Java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

Voici mon dossier

apply plugin: 'com.Android.application'
apply plugin: 'realm-Android'
apply plugin: 'com.google.firebase.firebase-crash'

Android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "pinnacle.org.rider"
        minSdkVersion 16
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
       // multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }

    useLibrary 'org.Apache.http.legacy'
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
        }

      /*  debug {
            minifyEnabled true
            shrinkResources true
        }*/
    }

    dataBinding {
        enabled true
    }

    dexOptions {
        jumboMode = true
        // here heap size give 4g i got this thing from https://groups.google.com/forum/#!topic/adt-dev/P_TLBTyFWVY
        javaMaxHeapSize "4g"
     }

    packagingOptions {
        exclude 'META-INF/NOTICE' // will not include NOTICE file
        exclude 'META-INF/LICENSE' // will not include LICENSE file
        exclude 'META-INF/notice'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license'
        exclude 'META-INF/license.txt'
    }
}


dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.Android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.Android.support', module: 'support-annotations'
    })
    compile project(':trupple-mvp')
    compile project(':pinbuoy')
    compile 'com.squareup:otto:1.3.8'
    compile 'io.card:Android-sdk:5.4.2'
    compile 'com.google.guava:guava:19.0'
    compile 'co.paystack.Android:paystack:2.1.2'
    testCompile 'org.robolectric:robolectric:3.1.1'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    compile 'com.google.firebase:firebase-crash:10.2.0'
    compile 'com.squareup.okhttp3:okhttp:3.3.0'
    compile 'com.squareup.okhttp3:logging-interceptor:3.3.0'
    compile 'com.squareup.retrofit2:retrofit:2.1.0'
    compile 'com.squareup.retrofit2:converter-gson:2.0.1'
    compile 'com.squareup.retrofit2:converter-jackson:2.0.1'
    compile 'com.github.cooltechworks:CreditCardView:v1.0'
    compile 'com.squareup.retrofit2:adapter-rxjava:2.0.1'
   // compile 'com.Android.support:multidex:1.0.1'
    compile 'javax.annotation:javax.annotation-api:1.2'
    compile 'de.hdodenhof:circleimageview:2.0.0'
    compile 'it.michelelacorte.swipeablecard:library:2.3.0'
    compile 'com.github.jorgecastilloprz:fabprogresscircle:1.01@aar'
    compile 'com.github.lawloretienne:discreteslider:0.0.9'
    compile 'com.jaredrummler:material-spinner:1.1.0'
    compile files('libs/libphonenumber-7.7.0.jar')
    compile('io.socket:socket.io-client:0.8.1') {
        exclude group: 'org.json', module: 'json'
    }
    compile 'com.Android.support:support-vector-drawable:25.1.1'
    compile 'com.github.dmytrodanylyk.circular-progress-button:library:1.1.3'
    compile 'com.Android.support.constraint:constraint-layout:1.0.0-beta5'
    testCompile 'org.mockito:mockito-core:1.9.5'
    testCompile 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

Mes bibliothèques personnalisées ont pour titre:

apply plugin: 'com.Android.library'

Android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "Android.support.test.runner.AndroidJUnitRunner"
    }

    useLibrary 'org.Apache.http.legacy'

    dataBinding {
        enabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.Android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.Android.support', module: 'support-annotations'
    })
    compile 'com.google.Android.gms:play-services:10.2.0'
    //compile 'com.Android.support:support-v4:25.1.1'
    compile 'com.Android.support:recyclerview-v7:25.1.1'
    //compile 'com.Android.support:appcompat-v7:25.1.1'
    compile 'com.Android.support:cardview-v7:25.1.1'
    compile 'com.Android.support:design:25.1.1'
    compile 'com.squareup.picasso:picasso:2.5.0'
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.1.6'
    compile 'com.google.code.gson:gson:2.7'
    testCompile 'junit:junit:4.12'

}

et le second avec

apply plugin: 'com.Android.library'

Android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "Android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-Android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.Android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.Android.support', module: 'support-annotations'
    })
    compile 'com.Android.support:appcompat-v7:25.1.1'
    testCompile 'junit:junit:4.12'
}

S'il vous plaît je suis coincé avec cela

J'ai résolu ceci en procédant comme suit.

  1. Choisir le paquet exact nécessaire dans le module de bibliothèque de services de lecture.
  2. Assurez-vous de ne pas dupliquer la bibliothèque de support.
  3. Nettoyer et reconstruire le projet.
  4. Conservé la source de la bibliothèque sous 64k méthodes, donc besoin de multidex.
8
geniusgeek

Il semble que la bibliothèque de support v4 manque dans les dépendances de votre gradueur d’applications. Essayez en ajoutant la bibliothèque de support v4

compile 'com.Android.support:support-v4:25.1.1'
2
MSC