从最近开始,我的应用开始在预发布报告中包含奇怪的错误消息(上传到 Play 商店后自动生成)。
这些报告包含以下例外情况:
Exception java.lang.NoSuchMethodError: No interface method a(Landroid/arch/lifecycle/e;Landroid/arch/lifecycle/b$a;)V in class Landroid/arch/lifecycle/GenericLifecycleObserver; or its super classes (declaration of 'android.arch.lifecycle.GenericLifecycleObserver' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
android.arch.lifecycle.f$a.a (f.java:326)
android.arch.lifecycle.f.a (f.java:159)
com.firebase.ui.database.FirebaseRecyclerAdapter.<init> (FirebaseRecyclerAdapter.java:40)
和:
Exception java.lang.NoSuchMethodError: No static method a(Landroid/app/Activity;)V in class Landroid/arch/lifecycle/ReportFragment; or its super classes (declaration of 'android.arch.lifecycle.ReportFragment' appears in /data/app/com.google.android.apps.mtaas.crawler-1/base.apk)
android.arch.lifecycle.LifecycleDispatcher$DispatcherActivityCallback.onActivityCreated (LifecycleDispatcher.java:77)
android.app.Application.dispatchActivityCreated (Application.java:219)
android.app.Activity.onCreate (Activity.java:1040)
android.support.v4.app.SupportActivity.onCreate (SupportActivity.java:66)
android.support.v4.app.FragmentActivity.onCreate (FragmentActivity.java:285)
android.support.v7.app.AppCompatActivity.onCreate (AppCompatActivity.java:84)
和:
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.arch.core.internal.SafeIterableMap.size()' on a null object reference
at android.arch.lifecycle.LifecycleRegistry.getObserverCount(LifecycleRegistry.java:204)
at android.arch.lifecycle.ProcessLifecycleOwner.b(ProcessLifecycleOwner.java:154)
at android.arch.lifecycle.ProcessLifecycleOwner.a(ProcessLifecycleOwner.java:100)
at android.arch.lifecycle.LifecycleRuntimeTrojanProvider.onCreate(LifecycleRuntimeTrojanProvider.java:36)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1751)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1726)
at android.app.ActivityThread.installProvider(ActivityThread.java:6031)
... 10 more
奇怪的是,我发布的应用程序似乎在真实设备上运行良好(异常仅在发布前测试期间出现)。
我试图恢复自上次构建以来执行的所有(主要)更改,其中我没有预发布问题:从 API 26 回到 API 27,支持库的旧版本,没有 D8 等,但到目前为止没有成功:在执行的 9 个测试中,只有 1 或 2 个成功,其余的则因此类错误而失败。
我能做些什么来解决这个问题?