java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap

前端 未结 3 1161
谎友^
谎友^ 2021-01-21 02:23

My app works perfectly when you run it on API 23 - 25, but on API 21 & 22 it crashes with the following error:

12-12 15:01:18.436 2         


        
相关标签:
3条回答
  • 2021-01-21 02:28

    Actually , There is one more reason of this issue : When we using gradle build with :

    compile 'com.google.android.gms:play-services:xxxx'
    

    We had to compile the entire package of APIs into our app.In some cases, doing so made it more difficult to keep the number of methods in our app (including framework APIs, library methods, and your own code) under the 65,536 limit. So the solution: we should build with only packages which we use : Example :

    compile 'com.google.android.gms:play-services-analytics:x.x.x'
    compile 'com.google.android.gms:play-services-gcm:x.x.x'
    

    More detail : https://developers.google.com/android/guides/setup

    0 讨论(0)
  • 2021-01-21 02:30

    I was having this same issue and solved it by adding these dependencies to the android/app/build.gradle file:

    dependencies {
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
        implementation 'com.google.firebase:firebase-analytics:17.2.0'
        // I had to add the following to fix this error.
        implementation 'com.google.firebase:firebase-auth:19.0.0'
        implementation 'com.google.firebase:firebase-firestore:21.1.1'
    }
    
    0 讨论(0)
  • 2021-01-21 02:49

    Just moving the comments into an answer.

    The 9.8.0 version of the firebase library is outdated and might not work well with the other support libraries.

    Try using the current version. (10.0.1 as of this answer). You'll also need to update the other Play Services dependencies accordingly

    0 讨论(0)
提交回复
热议问题