无法显示 AdMob 横幅,收到错误 HTTP 响应代码:400 等
Cannot display AdMob banners, Received error HTTP response code: 400 etc
无论我做什么,我都无法显示来自 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: 400
W/Ads ( 8161): There was a problem getting an ad response. ErrorCode: 0
W/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: 2
I/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 也未获得任何积极结果。
你们 post 最后能给点提示吗?
提前谢谢你。
卸载了 google 播放服务更新,它开始工作了。
您的包裹已被 Google AdMob 拦截。
如果您收到这样的电子邮件:
Hello,
This email is to alert you that one of your applications is not
currently in compliance with our AdMob program policies and as a
result, ad serving has been disabled to your application.
Issue ID#: 33943***
Ad serving has been disabled to: APPNAME
(com.example.pack)
Action required: Check all other remaining applications in your
account for compliance.
Current account status: Active
Violation explanation
GOOGLE PLAY REMOVAL: AdMob publishers are not permitted to abuse or
promote the abuse of any Google product, such as Google Play, YouTube,
or Blogger. This includes circumventing, or providing the means to
circumvent, the policies or terms of these or other Google products,
such as by allowing users to download YouTube videos.
If your app is removed by Google Play policy enforcement, please
contact Google Play about an app removal here. If Google Play
reinstates your app, please submit an appeal to our team.
Action required: Check account for compliance
While ad serving has been disabled to the above app, your AdMob
account remains active. We suggest that you take the time to review
the rest of your applications to ensure that they’re in compliance
with our policies, and to monitor your apps accordingly to reduce the
likelihood of future policy emails from us. Additionally, please note
that our team reserves the right to disable accounts at any time if we
continue to see violations occurring.
Appeals
If you wish to appeal this disabling then you can do so by using our
appeal form.
Thank you for your cooperation.
Sincerely,
The Google AdMob Team
所以现在您需要更改您的应用程序包。在 Eclipse 上它是 AndroidManifest.xml 文件
中的 package="com.example"
或
在 AndroidStudio 上 applicationId "com.example"
在 build.gradle 文件中
- 确保您已将最新的 google-services.json 从 firebase 控制台复制到您的项目根目录。
- 对于原生广告,不要 只需复制 Native Ads Express guide 中给出的示例代码即可。分析所有设备支持屏幕中可用的广告 space。例如,如果您只有 300 dp 的广告 space 实际上一个广告可以容纳,那么您不应在 adSize 属性中请求超过 300dp 的广告尺寸。
- 检查您设备的广告 space 是否可用(同时检查填充和边距),然后比较上面的广告尺寸 table 并选择适合的正确值。例如,如果您的设备宽度为 300dp,则将 adSize 值更改为 300x150 以获取广告并调整这些值以获得更好的广告展示效果。
- 如果您的广告 space 属于 中等 类别,请在 admob 中创建合适的广告单元。您可以使用您在代码中分配的 space 查看 admob 预览窗格中的广告展示。
- 如果您在 Admob 中新创建了 AdUnit ID,则 admob 服务器需要一些时间来审核和批准您的原生广告模板。所以请稍等片刻,然后重试(大约 1-2 小时)。同时确保你的代码符合以上4点。
我从 Google Play Services Ads 切换到 Firebase Ads 并在重启后清理项目 Android Studio 对我有用。
我有同样的问题。在我更新 AdMob 帐户中的结算和付款详细信息后,它开始为我工作。
无论我做什么,我都无法显示来自 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: 400
W/Ads ( 8161): There was a problem getting an ad response. ErrorCode: 0
W/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: 2
I/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 也未获得任何积极结果。 你们 post 最后能给点提示吗? 提前谢谢你。
卸载了 google 播放服务更新,它开始工作了。
您的包裹已被 Google AdMob 拦截。 如果您收到这样的电子邮件:
Hello,
This email is to alert you that one of your applications is not currently in compliance with our AdMob program policies and as a result, ad serving has been disabled to your application.
Issue ID#: 33943***
Ad serving has been disabled to: APPNAME (com.example.pack)
Action required: Check all other remaining applications in your account for compliance.
Current account status: Active
Violation explanation
GOOGLE PLAY REMOVAL: AdMob publishers are not permitted to abuse or promote the abuse of any Google product, such as Google Play, YouTube, or Blogger. This includes circumventing, or providing the means to circumvent, the policies or terms of these or other Google products, such as by allowing users to download YouTube videos.
If your app is removed by Google Play policy enforcement, please contact Google Play about an app removal here. If Google Play reinstates your app, please submit an appeal to our team.
Action required: Check account for compliance
While ad serving has been disabled to the above app, your AdMob account remains active. We suggest that you take the time to review the rest of your applications to ensure that they’re in compliance with our policies, and to monitor your apps accordingly to reduce the likelihood of future policy emails from us. Additionally, please note that our team reserves the right to disable accounts at any time if we continue to see violations occurring.
Appeals
If you wish to appeal this disabling then you can do so by using our appeal form.
Thank you for your cooperation.
Sincerely,
The Google AdMob Team
所以现在您需要更改您的应用程序包。在 Eclipse 上它是 AndroidManifest.xml 文件
中的package="com.example"
或
在 AndroidStudio 上 applicationId "com.example"
在 build.gradle 文件中
- 确保您已将最新的 google-services.json 从 firebase 控制台复制到您的项目根目录。
- 对于原生广告,不要 只需复制 Native Ads Express guide 中给出的示例代码即可。分析所有设备支持屏幕中可用的广告 space。例如,如果您只有 300 dp 的广告 space 实际上一个广告可以容纳,那么您不应在 adSize 属性中请求超过 300dp 的广告尺寸。
- 检查您设备的广告 space 是否可用(同时检查填充和边距),然后比较上面的广告尺寸 table 并选择适合的正确值。例如,如果您的设备宽度为 300dp,则将 adSize 值更改为 300x150 以获取广告并调整这些值以获得更好的广告展示效果。
- 如果您的广告 space 属于 中等 类别,请在 admob 中创建合适的广告单元。您可以使用您在代码中分配的 space 查看 admob 预览窗格中的广告展示。
- 如果您在 Admob 中新创建了 AdUnit ID,则 admob 服务器需要一些时间来审核和批准您的原生广告模板。所以请稍等片刻,然后重试(大约 1-2 小时)。同时确保你的代码符合以上4点。
我从 Google Play Services Ads 切换到 Firebase Ads 并在重启后清理项目 Android Studio 对我有用。
我有同样的问题。在我更新 AdMob 帐户中的结算和付款详细信息后,它开始为我工作。