我的AdMob广告未显示在调试版本上或从PlayStore下载后显示。从手机存储中安装广告后,广告会在发布版本中完美展示。在调试版本中,广告会在添加测试设备ID后显示[带有标签“ Test Ads”],否则在调试版本中将没有广告,且带有实时Ads ID。
我的应用代码:
private fun initAds() {
adRequest = AdRequest.Builder()
// .addTestDevice("0F599D3CA98C66B708C04713B88C384E")
// .addTestDevice("49C82A512ED4AFA9D0E3C84BA9A1AEB1")
// .addTestDevice("25902B4BC782D9DE7CBEB82B8027B726")
.build()
val mAdView = binding.adView
adView.visibility = View.GONE
mAdView.loadAd(adRequest)
mInterstitialAd = InterstitialAd(this)
mInterstitialAd.adUnitId = "ca-app-pub-xxxxxxxxxxxx/xxxxxxxxxx"
mInterstitialAd.loadAd(adRequest)
mAdView.adListener = object : AdListener() {
override fun onAdLoaded() {
super.onAdLoaded()
adView.visibility = View.VISIBLE
}
}
mInterstitialAd.adListener = object : AdListener() {
override fun onAdClosed() {
super.onAdClosed()
mInterstitialAd.loadAd(adRequest)
}
override fun onAdFailed(p0: Int) {
super.onAdFailed(p0: Int)
Log.i("Ads", "Ad Failed: "+p0)
}
}
}
Logcat的一些日志
2018-12-15 13:42:52.840 32148-32148/com.insightapps.textrepeater.remover I/Ads: Use AdRequest.Builder.addTestDevice("0F599D3CA98C66B708C04713B88C384E") to get test ads on this device.
2018-12-15 13:42:52.885 32148-32148/com.insightapps.textrepeater.remover I/Ads: Use AdRequest.Builder.addTestDevice("0F599D3CA98C66B708C04713B88C384E") to get test ads on this device.
2018-12-15 13:42:52.925 32148-32555/com.insightapps.textrepeater.remover W/Ads: Not retrying to fetch app settings
2018-12-15 13:42:53.523 28731-32337/? I/Ads: SDK version: afma-sdk-a-v14799021.14300000.1
2018-12-15 13:42:53.544 28731-32595/? I/Ads: SDK version: afma-sdk-a-v14799021.14300000.1
2018-12-15 13:43:04.150 32148-32148/com.insightapps.textrepeater.remover I/Ads: Ad failed to load : 3
2018-12-15 13:43:04.851 32148-32148/com.insightapps.textrepeater.remover I/Ads: Ad failed to load : 3
我正在使用SDK版本:
implementation 'com.google.android.gms:play-services-ads:17.1.2'
自从我遇到此问题以来已有2天了。任何帮助将不胜感激
答案 0 :(得分:0)
这正是您想要的。为什么测试广告不够用?
答案 1 :(得分:0)
4天后才出现广告。我想这是Google Admob政策的一项更改
答案 2 :(得分:0)
更新您的Gradle文件类路径'com.google.gms:google-services:4.1.0'