我正在尝试实施admob广告,如下所示:
MobileAds.initialize(getApplicationContext(), getString(R.string.banner_ad_unit_id));
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
当我使用测试设备ID时,我可以看到测试广告,但是当我使用上述代码时,该广告却不可见。这是上面的代码运行时看到的日志:
06-14 17:15:15.486 23521-23521/com.nick.app I/Ads: Starting ad request.
06-14 17:15:15.487 23521-23521/com.nick.app I/Ads: Use AdRequest.Builder.addTestDevice("**********************") to get test ads on this device.
06-14 17:15:18.356 23521-23521/com.nick.app E/Ads: JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
06-14 17:15:18.449 23521-23521/com.nick.app I/Ads: Ad finished loading.
06-14 17:15:18.477 23521-23521/com.nick.app E/Ads: JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
有什么建议吗?
最佳答案
起初我也遇到了这种情况,您必须稍等片刻。它应该在几个小时内显示,可能更少。