我正在使用 DoubleClick 在 Android 应用程序中设置广告,但无法展示最终的广告。有人可以帮助我吗?

当我通过添加“.addTestDevice("xxx...")”来测试广告时,我得到了测试广告,但当我删除此行时,出现以下错误:

W/Ads: No fill from ad server

W/Ads: Failed to load ad: 3

我这样设置广告:

PublisherAdRequest adRequest = new PublisherAdRequest.Builder().build(); 
mPublisherAdView.loadAd(adRequest); 

我的publisherView看起来像这样:

<com.google.android.gms.ads.doubleclick.PublisherAdView 
    android:id="@+id/pronostics_ad" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
 
    android:layout_gravity="center" 
 
    ads:adSize="BANNER" 
    ads:adUnitId="@string/ad_unit_pronostic"> 
</com.google.android.gms.ads.doubleclick.PublisherAdView> 

可能出了什么问题?

请您参考如下方法:

W/Ads: Failed to load ad: 3

根据 Documentation您收到以下错误代码:

public static final int ERROR_CODE_NO_FILL

The ad request was successful, but no ad was returned due to lack of ad inventory.

Constant Value: 3

基于帖子 onFailedToReceiveAd - Ad request successful, but no ad returned due to lack of ad inventory when using admob with adwhirl :

If you are getting this error, then your code is correct. The issue is that AdMob does not always have an ad to return for every request. This may happen particularly if you have just registered your AdMob publisher ID, as it takes some time and multiple requests before the new ID starts returning ads.

Another reason your fill rate may be low is that you don't have AdSense backfill enabled, or you have filtered out some ads. Check your app settings to see if that is the case.

编辑:

更新 app-ads.txt 并使用“setTestDeviceIds”在物理设备上进行测试。

截至编辑这些说明时: https://developers.google.com/admob/android/test-ads 工作了。为了测试广告,我使用了演示广告单元,需要添加 app-ads.txt 行并等待 admob 爬网程序(仅在 Android-12 模拟器上运行)对其进行爬网,但仍然在 Logcat 中收到使用“setTestDeviceIds”的说明 - 上述链接下的代码,结果需要在通过 USB 连接的物理设备上显示测试广告。


评论关闭
IT源码网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!