This week I started testing the new Firebase Performance in my new app. Once I am using Firebase for other features like Auth and DB I already updated all packages to last 10.2.6 Firebase version and follow all pre req instructions.
minAPI is 19.
My problem is App is crashing only in API 19 with Google Play Services 10.2.98 in a real Galaxy Duos device running Android 4.4.1. When App starts it could not find firebase-perf in device.
It is only happening with this package and in other devices and higher versions everything is fine and I can see data in Firebase Performance Dashboard.
Tips ?
Stacktrace below
Regards,
Process: com.mobilecodelabs.fb.trampo, PID: 2727
java.lang.RuntimeException: Unable to get provider com.google.firebase.perf.provider.FirebasePerfProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.perf.provider.FirebasePerfProvider" on path: DexPathList[[zip file "/data/app/com.mobilecodelabs.fb.trampo-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.mobilecodelabs.fb.trampo-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.installProvider(ActivityThread.java:4793)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.perf.provider.FirebasePerfProvider" on path: DexPathList[[zip file "/data/app/com.mobilecodelabs.fb.trampo-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.mobilecodelabs.fb.trampo-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.ActivityThread.installProvider(ActivityThread.java:4778)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:4385)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4325)
at android.app.ActivityThread.access$1500(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
This is an old issue but posting an update for the benefit of others.
I have run into this issue my self with the exact same stack trace. My app is failing on API 19 and below, where as on 21+ it works without any issue. For me it turned out to be a MultiDex issue.
Even though I had enabled MultiDex by giving
- multiDexEnabled true in Module gradle file under "defaultConfig" for API 21+
- "implementation 'com.android.support:multidex:1.0.3'" in Module gradle file under "dependencies" for API 20 and below my app failed with the above exception.
I had to make changes to the manifest file and replaced the fully qualified class name of my app with "android.support.multidex.MultiDexApplication"
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<application
android:name="android.support.multidex.MultiDexApplication" >
...
</application>
</manifest>
Please read this page on Multidex for further details. And here is the reference for the application attribute. I have tested my app in the Firebase test labs and physical devices and it works on all versions from API 17 to API 28.
来源:https://stackoverflow.com/questions/44170073/firebase-performance-crashing-in-api-19-with-google-play-services-10-2-98