javaandroidandroidxandroid-workmanagerfirebase-job-dispatcher

IncompatibleClassChangeError with androidx.work.logger


We have updated android.arch.work:work-runtime:1.0.0-beta01 and we are getting a lot of crashes on clients:

The method 'void androidx.work.Logger.debug was expected to be of type static but instead was found to be of type virtual at androidx.work.impl.background.firebase.FirebaseJobService.onStartJob(FirebaseJobService.java:65)

Seems to be an internal problem in AndroidX / FirebaseJobService. We are getting reports from clients and Crashlytics (for now 100% on android 5.0)

build.gradle:

dependencies {
 implementation files('libs/gcm.jar')

 implementation 'org.apache.commons:commons-lang3:3.5'
 implementation 'com.squareup.okhttp3:okhttp:3.10.0'

 implementation 'androidx.multidex:multidex:2.0.1'
 implementation 'com.google.android.gms:play-services-gcm:16.0.0'
 implementation 'com.google.android.gms:play-services-location:16.0.0'
 implementation 'com.google.android.gms:play-services-maps:16.0.0'
 implementation 'com.google.android.gms:play-services-auth:16.0.1'
 implementation 'com.google.maps.android:android-maps-utils:0.5'

 implementation 'androidx.legacy:legacy-support-v4:1.0.0'
 implementation 'androidx.appcompat:appcompat:1.0.2'
 implementation 'androidx.recyclerview:recyclerview:1.0.0'
 implementation 'android.arch.work:work-runtime:1.0.0-beta01'
 implementation 'android.arch.work:work-firebase:1.0.0-alpha11'
 implementation 'com.google.android.material:material:1.0.0'

 implementation 'com.google.code.gson:gson:2.8.2'
 implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.1'
 implementation 'com.google.firebase:firebase-core:16.0.6'
 implementation 'com.google.firebase:firebase-appindexing:17.1.0'
 implementation 'com.google.firebase:firebase-auth:16.1.0'
 implementation 'com.google.firebase:firebase-storage:16.0.5'
 implementation 'com.google.firebase:firebase-database:16.0.5'
 implementation 'com.google.firebase:firebase-messaging:17.3.4'
 implementation 'com.google.firebase:firebase-config:16.1.2'
 implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
 implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'

 implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.3'
}

We are getting the following stack trace:

Fatal Exception: java.lang.IncompatibleClassChangeError: The method 'void androidx.work.Logger.debug(java.lang.String, java.lang.String, java.lang.Throwable[])' was expected to be of type static but instead was found to be of type virtual (declaration of 'java.lang.reflect.ArtMethod' appears in /system/framework/core-libart.jar)
       at androidx.work.impl.background.firebase.FirebaseJobService.onStartJob(FirebaseJobService.java:65)
       at com.firebase.jobdispatcher.JobService$2.run(JobService.java:164)
       at android.os.Handler.handleCallback(Handler.java:739)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:135)
       at android.app.ActivityThread.main(ActivityThread.java:5274)
       at java.lang.reflect.Method.invoke(Method.java)
       at java.lang.reflect.Method.invoke(Method.java:372)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)

Solution

  • You are mixing WorkManager (beta01) and the optional Firebase dependency (alpha11). You can't mix versions (see https://issuetracker.google.com/issues/122028782). The Firebase dependency has been deprecated, so you should remove it entirely.