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

后端 未结 4 983
囚心锁ツ
囚心锁ツ 2020-12-17 10:16

Today i found this error while trying to run my app. I made the following attempts towards solving it. - First i removed multidex support, but i can still see the slices of

相关标签:
4条回答
  • 2020-12-17 10:42

    for me I found this change fixed my issue. I had a repo that built find in July this year. Then as I kept my build environment up to date with flutter etc, it wouldn't build this project but built my other project fine. I found this difference:

    --- a/android/build.gradle
    +++ b/android/build.gradle
    @@ -5,8 +5,8 @@ buildscript {
         }
    
         dependencies {
    -        classpath 'com.android.tools.build:gradle:3.2.1'
    -        classpath 'com.google.gms:google-services:4.2.0'
    +        classpath 'com.android.tools.build:gradle:3.3.0'
    +        classpath 'com.google.gms:google-services:4.3.0'
         }
     }
    
    0 讨论(0)
  • 2020-12-17 10:54

    I had the same problem and solved it by editing the build.gradle file like this:

    ...
    
    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'
    
      //Add these lines to fix the error.
      implementation 'com.google.firebase:firebase-analytics:17.2.1'
      implementation 'com.google.firebase:firebase-auth:19.2.0'
      implementation 'com.google.firebase:firebase-firestore:21.3.0'
    }
    
    apply plugin: 'com.google.gms.google-services'
    
    0 讨论(0)
  • 2020-12-17 10:57

    It looks you are missing v4 support library in your app gradle dependencies. Try by adding v4 support library

    compile 'com.android.support:support-v4:25.1.1'
    
    0 讨论(0)
  • 2020-12-17 10:59

    I faced the same problem with Flutter and this question was the first link on Google when I searched my error:

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

    So the root of your problem might be same: AndroidX adaptation. Adding those lines to gradle.properties fixed my problem:

    android.useAndroidX=true
    android.enableJetifier=true
    

    You may also want to add compileSdkVersion 28 to your app-level build.gradle file. For further information

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