diff --git a/firebase-perf/src/main/java/com/google/firebase/perf/metrics/AppStartTrace.java b/firebase-perf/src/main/java/com/google/firebase/perf/metrics/AppStartTrace.java index d38d260503b..2b24d616e03 100644 --- a/firebase-perf/src/main/java/com/google/firebase/perf/metrics/AppStartTrace.java +++ b/firebase-perf/src/main/java/com/google/firebase/perf/metrics/AppStartTrace.java @@ -446,7 +446,9 @@ public void onActivityPaused(Activity activity) { return; } View rootView = activity.findViewById(android.R.id.content); - rootView.getViewTreeObserver().removeOnDrawListener(onDrawCounterListener); + if (rootView == null) { + rootView.getViewTreeObserver().removeOnDrawListener(onDrawCounterListener); + } } @Override