无论我做什么,都无法显示来自Admob的横幅广告,我在两种不同的Android设备上进行了测试,结果如下:
第一台设备:
I/Ads ( 8161): Starting ad request.I/Ads ( 8161): Please set theme of AdActivity to @androID:style/theme.Translucent to enable transparent background interstitial ad.I/Ads ( 1006): CsiReporterFactory: CSI is not enabled. No CSI reporter created.W/Ads ( 1006): Js: The page at about:blank displayed insecure content from gmsg://mobileads.Google.com/loadAdURL?drt_include=0&request_ID=............W/Ads ( 1006): (null:1)W/Web Console( 1006): The page at about:blank displayed insecure content from gmsg://mobileads.Google.com/loadAdURL?drt_include=0&request_ID=............W/Ads ( 1006): Js: The page at about:blank displayed insecure content from gmsg://mobileads.Google.com/loadAdURL?drt_include=0&request_ID=............W/Ads ( 1006): (null:1)W/Web Console( 1006): The page at about:blank displayed insecure content from gmsg://mobileads.Google.com/loadAdURL?drt_include=0&request_ID=............W/Ads ( 1006): Js: The page at https://Googleads.g.doubleclick.net/mads/static/mad/sdk/native/sdk-core-v40.HTML displayed insecure content from file:///androID_asset/webkit/androID-weberror.png.W/Ads ( 1006): (null:1)W/Ads ( 1006): Received error http response code: 400W/Ads ( 8161): There was a problem getting an ad response. ErrorCode: 0W/Ads ( 8161): Failed to load ad: 0
注意:此处不会调用onAdLoaded()和onAdFailedToload()
第二个设备:
I/Ads ( 1165): CsiReporterFactory: CSI is not enabled. No CSI reporter created.I/Ads ( 1165): Starting ad request.I/Ads ( 1165): Use AdRequest.Builder.addTestDevice("XXXXXXXXXXXXXXXXXXXXXXXXXX") to get test ads on this device. I/Ads ( 1165): CsiReporterFactory: CSI is not enabled. No CSI reporter created.W/Ads ( 1165): There was a problem getting an ad response. ErrorCode: 2I/Ads ( 1165): Scheduling ad refresh 60000 milliseconds from Now.W/Ads ( 1165): Failed to load ad: 2
我的代码:
protected voID onCreate( Bundle icicle ){ super.onCreate( icicle );m_glVIEw = initopenGLVIEw( ); m_adMobVIEw = new AdVIEw( this ); m_adMobVIEw.setAdSize( AdSize.SMART_BANNER ); m_adMobVIEw.setAdUnitID( "XXXXXXXXXXXXXXXXXX" ); <----I just replaced the ID with XXX for this example m_adMobVIEw.setAdListener( new AdListener( ) { public voID onAdLoaded( ) { egNative.LogMessage( "ADMob::onAdLoaded" ); }; public voID onAdFailedToload( ) { egNative.LogMessage( "ADMob::onAdFailedToload" ); } } ); FrameLayout layout = new FrameLayout( getApplicationContext( ) ); layout.addVIEw( m_glVIEw ); int gravity = androID.vIEw.Gravity.CENTER_HORIZONTAL | androID.vIEw.Gravity.top; FrameLayout.LayoutParams params = new FrameLayout.LayoutParams( FrameLayout.LayoutParams.WRAP_CONTENT , FrameLayout.LayoutParams.WRAP_CONTENT , gravity ); layout.addVIEw( m_adMobVIEw , params );setContentVIEw( layout );}@OverrIDe protected voID onStart( ) { super.onStart( ); AdRequest.Builder ad_builder = new AdRequest.Builder( ); m_adMobVIEw.loadAd( ad_builder.build( ) ); }
我正在运行最新版本的Google Play服务.还仔细检查了广告单元ID,就可以了.测试广告单元ID也没有得到任何肯定的结果.
你们最终可以发布任何提示吗?
先感谢您.
解决方法:
>确保已将最新的Google-services.Json从firebase控制台复制到您的项目根目录.
>对于原生广告,不要简单地复制Native Ads Express guide中给出的示例代码.分析所有设备支持屏幕上可用的广告空间.例如,如果您实际上只能容纳300 dp广告空间,那么您不应在adSize属性中要求广告尺寸超过300 dp.
>检查设备的可用广告空间(还检查填充和边距),然后比较上方的广告尺寸表并选择适合的值.例如,如果您的设备宽度为300dp,则将adSize值更改为300×150以获取广告,并调整这些值以更好地展示广告.
>如果您的广告空间属于中等类别,请在admob中创建一个合适的广告单元.您可以使用代码中分配的空间在admob预览窗格中查看广告演示.
>如果您是在Admob中新创建的AdUnit ID,则admob服务器会花一些时间来审核&批准您的原生广告模板.因此,请等待一段时间,然后重试(约1-2小时).同时,请确保您的代码符合上述所有4点. 总结
以上是内存溢出为你收集整理的android-无法显示AdMob标语,收到错误HTTP响应代码:400等全部内容,希望文章能够帮你解决android-无法显示AdMob标语,收到错误HTTP响应代码:400等所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)