我最近遇到以下问题:在 Android 8 及更高版本的设备上接收推送通知时应用程序崩溃。
这是堆栈跟踪:
#0. Crashed: main
at com.google.firebase.iid.zzh.void onServiceConnected(android.content.ComponentName,android.os.IBinder)(Unknown Source:4)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1652)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1681)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
--
Fatal Exception: java.lang.ClassCastException: android.app.job.JobServiceEngine$JobInterface cannot be cast to com.google.firebase.iid.zzf
at com.google.firebase.iid.zzh.void onServiceConnected(android.content.ComponentName,android.os.IBinder)(Unknown Source:4)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1652)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1681)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
这些是库版本:
//Google services
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-analytics:16.0.0'
//Firebase
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
transitive = true;
}
我试图降级 firebase,直到有必要降级 Google 服务的版本——它没有帮助。
该项目使用推送提供者的第三方库(infobip ),很可能是其中的问题。
有人对此有任何想法吗?