Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter - crash on Xiaomi Device running on Android 4.4 (Kitkat) - Firebase Error

i got this error only on Xiaomi Device, especially on Android 4.4 (KitKat).

My App suddenly crash at beginning, i have catch error log :

E/AndroidRuntime(15685): FATAL EXCEPTION: main
E/AndroidRuntime(15685): Process: z.zapps, PID: 15685
E/AndroidRuntime(15685): java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/z.zapps-1.apk"],nativeLibraryDirectories=[/data/app-lib/z.zapps-1, /vendor/lib, /system/lib]]
E/AndroidRuntime(15685):    at android.app.ActivityThread.installProvider(ActivityThread.java:4828)
E/AndroidRuntime(15685):    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4420)
E/AndroidRuntime(15685):    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4360)
E/AndroidRuntime(15685):    at android.app.ActivityThread.access$1500(ActivityThread.java:141)
E/AndroidRuntime(15685):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1272)
E/AndroidRuntime(15685):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(15685):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(15685):    at android.app.ActivityThread.main(ActivityThread.java:5052)
E/AndroidRuntime(15685):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(15685):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(15685):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:796)
E/AndroidRuntime(15685):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:612)
E/AndroidRuntime(15685):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(15685): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/z.zapps-1.apk"],nativeLibraryDirectories=[/data/app-lib/z.zapps-1, /vendor/lib, /system/lib]]
E/AndroidRuntime(15685):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
E/AndroidRuntime(15685):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
E/AndroidRuntime(15685):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
E/AndroidRuntime(15685):    at android.app.ActivityThread.installProvider(ActivityThread.java:4813)
E/AndroidRuntime(15685):    ... 12 more
W/ActivityManager( 1065):   Force finishing activity z.zapps/.MainActivity

i'm using firebase library at pubspec.yaml:

firebase_auth: ^0.8.2 and firebase_messaging: ^4.0.0+4

any idea to solve this ?

like image 298
zukijuki Avatar asked Nov 27 '25 02:11

zukijuki


1 Answers

Short answer : Make the APK file with command : flutter build apk --target-platform=android-arm

Long Answer : The problem is with the device's processor type. In the Android world, there are 7 different processor types (mips, mips64, X86, X86–64, armeabi, arm64-v8a, armeabi-v7a). The standard flutter build apk command doesn't produce an universal file.

I think you've problem with armeabi processor which uses ARM based architecture.

To solve this issue, you'll have to make a specific APK to support the device (family). And to do it, you might want to use following command :

flutter build apk --target-platform=android-arm

Does this mean you'll have two different versions of APK for the same app ? Yes.

Here is more information and here is Google's official document.

like image 131
Sukhi Avatar answered Nov 29 '25 16:11

Sukhi