Max Railian
Max Railian

Reputation: 65

App crashes when received push from firebase on android 8+

I recently encountered the following problem: the application crashes when receiving push notifications on devices with Android version 8 and higher.

Here is the stacktrace:

#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)

These are the library versions:

 //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;
}

I tried to downgrade firebase until it became necessary to downgrade the version of Google services — it did not help.

The project uses a third-party library of the provider of pushes (infobip ), most likely the problem in it.

Does anyone have an idea about this?

Upvotes: 3

Views: 869

Answers (1)

Paraskevas Ntsounos
Paraskevas Ntsounos

Reputation: 1777

Try to update your dependencies in latest version based on this link and also add firebase-messaging:

    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-analytics:16.0.3'
    implementation 'com.google.firebase:firebase-appindexing:16.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-firestore:17.1.0'
    implementation 'com.google.firebase:firebase-functions:16.1.0'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-crash:16.2.0'
    implementation 'com.google.firebase:firebase-invites:16.0.3'
    implementation 'com.google.firebase:firebase-perf:16.1.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-config:16.0.0'

And make sure that your buildscript in your project level grandle is like:

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'
        classpath 'com.google.gms:google-services:4.0.1'
    }
}

Also if you have play-services make sure you update based on this link:

implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'

Upvotes: 1

Related Questions