我添加了最新的 Firebase Performance SDK,并且在 Android 8(Oreo) 或更高版本中,应用程序崩溃并出现从未添加的错误消息 OnFrameMetricsAvailableListener。
应用级 build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.firebase:firebase-plugins:1.1.5'
}
app 模块级 build.gradle
dependencies {
other
..............
..............
// Android support
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
// Android Gms Play Services
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
// Firebase
implementation 'com.google.firebase:firebase-perf:16.2.2'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
日志
Caused by: java.lang.IllegalArgumentException: attempt to remove OnFrameMetricsAvailableListener that was never added
at android.view.View.removeFrameMetricsListener(View.java:6862)
at android.view.Window.removeOnFrameMetricsAvailableListener(Window.java:890)
at android.support.v4.app.FrameMetricsAggregator$FrameMetricsApi24Impl.remove(FrameMetricsAggregator.java:436)
at android.support.v4.app.FrameMetricsAggregator.remove(FrameMetricsAggregator.java:246)
at com.google.firebase.perf.internal.zza.onActivityStopped(Unknown Source:64)
at android.app.Application.dispatchActivityStopped(Application.java:258)
at android.app.Activity.onStop(Activity.java:1950)
at android.support.v4.app.FragmentActivity.onStop(FragmentActivity.java:636)
at android.support.v7.app.AppCompatActivity.onStop(AppCompatActivity.java:184)
at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1382)
at android.app.Activity.performStop(Activity.java:7526)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4591)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4652)
at android.app.ActivityThread.-wrap5(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1784)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7002)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)