Java.lang.NoClassDefFoundError: permission failure: Landroid / support / v4 / util / ArrayMap

My application works fine 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 27069-27069/com.platinum.hydro E/AndroidRuntime: FATAL EXCEPTION: main Process: com.platinum.hydro, PID: 27069 java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/util/ArrayMap; at com.google.firebase.FirebaseApp.<clinit>(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:5319) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4893) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4833) at android.app.ActivityThread.access$1500(ActivityThread.java:178) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5631) 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/com.platinum.hydro-2/base.apk"],nativeLibraryDirectories=[/data/app/com.platinum.hydro-2/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.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:5319) at android.app.ActivityThread.installContentProviders(ActivityThread.java:4893) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4833) at android.app.ActivityThread.access$1500(ActivityThread.java:178) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1531) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5631) 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) ... 18 more Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available 
+3
source share
3 answers

Just move the comments back.

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

Try using the current version. ( 10.0.1 from this answer). You will also need to update other dependencies of the Services Services.

+3
source

In fact, there is another reason for this question: When we use gradle build with:

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

We had to collect the entire API package into our application. In some cases, this made it difficult to maintain the number of methods in our application (including front-end APIs, library methods, and native code) under the 65,536 limit. So, the solution: we should build only with the packages we use: Example:

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

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

+1
source

I had the same problem and solved it by adding these dependencies to the android/app/build.gradle :

 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
source

Source: https://habr.com/ru/post/1015168/


All Articles