diff --git a/packages/firebase_admob/android/src/main/java/io/flutter/plugins/firebaseadmob/MobileAd.java b/packages/firebase_admob/android/src/main/java/io/flutter/plugins/firebaseadmob/MobileAd.java index a13573194c94..f1456dda26ea 100644 --- a/packages/firebase_admob/android/src/main/java/io/flutter/plugins/firebaseadmob/MobileAd.java +++ b/packages/firebase_admob/android/src/main/java/io/flutter/plugins/firebaseadmob/MobileAd.java @@ -182,11 +182,11 @@ void show() { void dispose() { super.dispose(); + adView.destroy(); + View contentView = activity.findViewById(id); if (contentView == null || !(contentView.getParent() instanceof ViewGroup)) return; - adView.destroy(); - ViewGroup contentParent = (ViewGroup) (contentView.getParent()); contentParent.removeView(contentView); }