Coder
Coder

Reputation: 355

Failed to load AdMob on flutter

Whenever I try to load an ad using AdMob, I get the following error

W/Ads     (23418): There was a problem getting an ad 
response.ErrorCode: 0
W/Ads     (23418): Failed to load ad: 0
W/flutter (23418): onAdFailedToLoad: 0
I/flutter (23418): BannerAd event is MobileAdEvent.failedToLoad

I am using the android emulator and I am using only banner ads and I don't know why this error is occurring.

Upvotes: 7

Views: 11298

Answers (3)

Saya Gamers
Saya Gamers

Reputation: 171

When I used firebase_admob 0.9.0+3, I encountered this error, this resolution worked for me, below:

You need to add "admob_app_id" value into ..android/app/google-services.json file, after the "services" tag.

"admob_app_id": "ca-app-pub-your app~id" *(*change your admob app id here)

You can find this file also admob panel/ your app / your banner name / Implementation instructions / bullet nr. 3

(if you already have this file, add only this line)


By the way, meaning the other fail numbers are :

  • onAdFailedToLoad: 2 (The current network security does not allow the ad to arrive)
  • onAdFailedToLoad: 3 (No problem in admob call, but admob repository did not send ads - generally in emulators)

The remaining fail numbers can be found Here

Upvotes: 17

bamossza
bamossza

Reputation: 3926

A problem like me.

Let's see the solution to my problem.

I used admob_flutter 0.3.4

https://pub.dev/packages/admob_flutter

Let's see how to config.

If this package you can config according to the document below,

https://pub.dev/packages/admob_flutter/example

iOS

File: Info.plist add below,

<key>GADIsAdManagerApp</key>
<true/>
<key>io.flutter.embedded_views_preview</key>
<true/>

Android

File: AndroidManifest.xml add code below,

<meta-data
    android:name="com.google.android.gms.ads.AD_MANAGER_APP"
    android:value="true"/>

Run test:

iOS:

enter image description here

Android

enter image description here

Finally,

In case anyone with problems like me will be saved time

flutter doctor -v

enter image description here

Work for me. ^___^

Upvotes: 0

Ajay Tom George
Ajay Tom George

Reputation: 2279

Check this explanation first from community Google community explanation of error codes

if still doesn't work, It could be because of unimplemented steps in the AdMob account. Example. Payment verification or account verification.

Go to your AdMob account home Admob Home and check for these notifications Google FAQ

Detailed info about error codes is given here

If everythingAccount verified in AdMob account is okay, It should show something like this in home page

Upvotes: 1

Related Questions