AdMob错误代码0大部分 [英] AdMob ErrorCode 0 mostly

查看:504
本文介绍了AdMob错误代码0大部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试为其添加广告的Android应用程序时遇到问题,奇怪的是,广告在第一个活动中完美加载,但没有其他活动。我已按照 https://developers.google.com/admob/android/上的说明进行操作现有应用,但无济于事,它仍然仅适用于第一个活动。对于每个我也有广告的活动,我都有一个不同的广告单元ID,并已将其从网站上复制粘贴以免出错,并删除了所有空白。

I have a problem with my Android App which I'm trying to add ads for, the weird thing is that the ad loads perfectly on the first activity, but none of the others. I've followed the instructions on https://developers.google.com/admob/android/existing-app, but to no avail it still only works with the first activity. I have a different Ad Unit ID for each activity that I have ads on as well, and have copy-pasted them from the website to avoid mistakes, and have removed all whitespace.

我得到的响应是:

There was a problem getting an ad response. ErrorCode: 0
Failed to load ad: 0

我已经研究了为什么会从AdMob收到此回复,我已经尝试过找到的解决方案,它们是将正确的Google Play服务版本(并检查更新)添加到我的build.gradle文件中,然后将该版本添加到我的清单文件中,我正在真实手机(LG G4运行Lollipop)附带的rom上运行它,甚至尝试在另一部也运行Android的手机上获得相同的结果。

I've done research on why I'd get this response from AdMob, and I've tried the solutions I have found, they are to add the correct version (and check for updates) of the Google Play Services to my build.gradle file, to add the version to my manifest file, I am running it on the stock rom that came with a real phone (LG G4 running Lollipop) I even tried on a different phone which was also running stock Android to get the same result.

将广告加载到页面上的方式是使用以下代码:

The way I load the ads onto my page is with this code:

AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

在每个带有广告的活动中都是相同的。

This is the same on every activity with ads on it.

这是我的清单文件的片段:

This is a snippet of my Manifest file:

<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

最后,这是我的布局文件的广告片段,在我的所有文件中都相同布局:

Finally, this is the ad snippet of my layout file, which is also the same in all of my layouts:

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_home">
</com.google.android.gms.ads.AdView>

每个活动广告单元ID都有一个字符串资源。

I have a string resource for each different activity Ad Unit ID.

推荐答案

它刚刚开始起作用,我什么都没改变。也许以前有问题吗?谁知道,谢谢大家的帮助。

It just started working, I changed nothing. Maybe there was a problem building it before? Who knows, thanks for all the help though guys.

这篇关于AdMob错误代码0大部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆