BannerAd event is MobileAdEvent.failedToLoad


W/flutter (29884): onAdFailedToLoad: 3
I/Ads     (29884): Ad failed to load : 3
I/flutter (29884): BannerAd event is MobileAdEvent.failedToLoad

我制作了一个Firebase帐户,然后连接到Flutter应用程序,但是出了点问题。你能帮我吗?

看起来您在广告单元ID中犯了常见错误。检查您是否不使用thesame 应用ID AD单元ID

AD单元ID看起来像ca-app-pub-504515xxxxxxxxx/xxxxxxxxx(您应该用于广告单元(,虽然应用ID看起来像ca-app-pub-504515xxxxxxxxx~xxxxxxxxx-用于应用程序ID,而不是用于广告单元ID。您需要一个由/

分开的

解决方案代码:

BannerAd myBanner = BannerAd(
  // Replace the testAdUnitId with an ad unit id from the AdMob dash.
  // https://developers.google.com/admob/android/test-ads
  // https://developers.google.com/admob/ios/test-ads
  //  adUnitId: BannerAd.testAdUnitId,
  adUnitId: "ca-app-pub-504515xxxxxxxxx/xxxxxxxxx", // look out for this
  size: AdSize.smartBanner,
  targetingInfo: targetingInfo,
  listener: (MobileAdEvent event) {
    print("BannerAd event is $event");
  },
);

最新更新