From 53095f76a55ddac33c323a0a3a5d5e1d2475a9e7 Mon Sep 17 00:00:00 2001 From: Collin Jackson Date: Fri, 16 Aug 2019 17:25:51 -0700 Subject: [PATCH] [firebase_admob]Destroy adView Before contentView Checking --- .../main/java/io/flutter/plugins/firebaseadmob/MobileAd.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0b3fa19c64f6..fedeb1c6da9c 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 @@ -177,11 +177,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); }