Using test banner ad id in flutter throwing exception - "Ad for following adId already exists: 0"

1,092

Solution 1

Check that you haven't forgot to add:

MobileAds.instance.initialize();

Solution 2

Using hot reload or hot restart while working with ads creates this problem. It can be solved by using flutter clean or running it after closing. When someone hot reloads or restarts app while checking ad functionality, the system takes the previously running app and the one that will come after reload or restart as two different entity. And these entities are trying to use the same ad id and that pulls the trigger of this problem.

Solution 3

I also had a similar problem. I found out after research and testing that one unit ad needs a unique ad unit id.

The unique identifier for an ad unit. When you implement a new ad unit in your app, you'll reference the ad unit ID to tell ad networks where to send ads when they're requested. You can find the ad unit ID of an app in the app's ad units table.

Check

Go to your adMob dashboard and for your dsired app create new ad unit.

In my case there were two ads in my application's dashboard. So I created two ad units. And don't froget to release your ad object.

@override
void dispose() {
  // TODO: Dispose a BannerAd object
  _ad?.dispose();

  super.dispose();
}
Share:
1,092
Himel
Author by

Himel

Updated on December 28, 2022

Comments