简体   繁体   中英

Flutter: firebase_admob ads are not showing

I believe I follow the steps exactly: https://pub.dartlang.org/packages/firebase_admob

...but nothing. No real ads, no test ads, nothing in "flutter run", nothing in "flutter build". I tried InterstitialAd.testAdUnitId and FirebaseAdMob.testAppId and testDevices ...

All I can get is:

W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0
W/flutter: onAdFailedToLoad: 0

And I see this in Android Monitor:

E/Ads: Error waiting for future.
java.util.concurrent.ExecutionException: java.util.concurrent.TimeoutException
at com.google.android.gms.ads.internal.util.future.ae.get(:com.google.android.gms@13278037@13.2.78 (100400-210410490):11)
at com.google.android.gms.ads.internal.util.future.g.a(:com.google.android.gms@13278037@13.2.78 (100400-210410490):13)
at com.google.android.gms.ads.internal.request.service.c.a(:com.google.android.gms@13278037@13.2.78 (100400-210410490):65)
at com.google.android.gms.ads.internal.request.service.c.a(:com.google.android.gms@13278037@13.2.78 (100400-210410490):198)
at com.google.android.gms.ads.internal.request.service.f.run(:com.google.android.gms@13278037@13.2.78 (100400-210410490):1)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.util.concurrent.TimeoutException
at com.google.android.gms.ads.internal.util.future.m.run(Unknown Source:2)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
at java.lang.Thread.run(Thread.java:764)

I don't have any ad blocking installed, problem doesn't depend on type of internet connection (WiFi vs. mobile) ...

At one point I gave up. Few days later I just tried the app again and I did see some ads. But the day after that they were gone again - without any change in the app, even without a rebuild/reinstall.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v0.7.6-pre.57, on Mac OS X 10.13.5 17F77, locale cs-CZ)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.1)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Ultimate Edition (version 2017.3.5)
[✓] Connected devices (1 available)

可能的原因:android manifest 或runner info.plist 文件中的internet 权限firebase admob 错误的代码放置了app id 而不是ad unit id 互联网服务提供商防火墙

Ads have to be loaded before they are shown. It can take anywhere from 3s to 10s for an ad to load after the function. The issue is that if the loadAd function is called it takes several seconds to return an ad, by which point showAd has already executed and will return an error since the ad is still loading. Report as a bug on github. loadAd functions should be added to the end of the stream in the plugin itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM