在发布模式下未显示admob。 但是在测试模式下,它可以正常工作。 释放模式会提示您添加测试设备。
MobileAds.initialize(this, "ca-app-pub);
AdRequest adRequest = new AdRequest.Builder()
//.addTestDevice("42DACEF759D862A1F97B643B83982FB6") //This line has been commented out.
.build();
adFull = new InterstitialAd(MainActivity.this);
adFull.setAdUnitId("UnitId");
adFull.loadAd(adRequest);
Logcat消息>>
2019-03-26 12:16:40.969 8865-8865/? I/Ads: Use AdRequest.Builder.addTestDevice("42DACEF759D862A1F97B643B83982FB6") to get test ads on this device.
2019-03-26 12:16:41.340 5349-9213/? W/Ads: App does not have the required permissions to get location
2019-03-26 12:16:41.524 5349-10814/? I/Ads: SDK version: afma-sdk-a-v15090019.15000000.1
2019-03-26 12:16:42.113 8865-8865/? I/Ads: Ad failed to load : 3