带有androidx.work.logger的IncompatibleClassChangeError

时间:2019-01-02 19:39:50

标签: java android androidx android-workmanager firebase-job-dispatcher

我们已经更新了android.arch.work:work-runtime:1.0.0-beta01,并且在客户端上发生了很多崩溃:

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)

似乎是AndroidX / FirebaseJobService中的内部问题。 我们正在从客户端和Crashlytics获取报告(目前在Android 5.0上为100%)

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'
}

我们将获得以下堆栈跟踪:

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)

1 个答案:

答案 0 :(得分:1)

您正在混合WorkManager(beta01)和可选的Firebase依赖项(alpha11)。您不能混合使用版本(请参见https://issuetracker.google.com/issues/122028782)。 Firebase依赖项已被弃用,因此您应将其完全删除。