AdMob 4.3.1 添加不显示(还没有 AdMob ID(仅用于测试),无法获取 ViewWidth)
首先,我知道关于这个话题有很多问题。我在互联网上进行了搜索,但大多数教程都是关于旧版本的 AdMob。此外,对于这个问题,所有人都有某种不同的解决方案。它们都不适合我。我非常非常接近将这些测试添加到我的应用程序中。他们只是不出现。我收到以下错误:
02-21 21:05:46.457: W/webcore(14924): 第一次布局后无法获取 viewWidth
02-21 21:05:46.586: W/Ads(14924):无效的未知请求错误:无法确定请求类型。您的广告单元 ID 正确吗?
02-21 21:05:46.586: D/webviewglue(14924): nativeDestroy 视图: 0x685300
02-21 21:05:46.586: I/Ads(14924): onFailedToReceiveAd(无效的 Google 广告请求。)
我没有 AdMob还没有发布者 ID,因为这将是我的第一个应用程序市场(我首先必须在市场上有一个APP,然后才能获得该APP的ID)。我应该使用什么 ID?目前我有(在我的 Android 手机上测试):
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice("9B08CXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
//adRequest.addTestDevice("037c7xxxxxxxxxxx"); (Not right, is from console)
AdView adView = (AdView) this.findViewById(R.id.adView);
adView.loadAd(adRequest);
在我的 XML 中,我有(因为它还警告 viewWidth?)。它被包装在一个更大的 LinearLayout 中:
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="50dip">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/admob_pub_id"/>
</LinearLayout>
我希望问题足够小,但仍然包含足够的信息。
提前致谢! 亲切的问候, 乔斯。
编辑:我确实更改了清单文件(添加权限、活动 android:name=...、 android:configChanges=...)。我将 jar 添加到 lib 文件夹并将其添加到库中。
First of all, I know there are a lot of questions about this topic. I searched all over the internet, but most of the tutorials are about older versions of AdMob. Also, all have some kind of different solution for the problem. They all do not work for me. I am very very close to getting these test adds into my application. They just don't show up. I get the following errors:
02-21 21:05:46.457: W/webcore(14924): Can't get the viewWidth after the first layout
02-21 21:05:46.586: W/Ads(14924): Invalid unknown request error: Cannot determine request type. Is your ad unit id correct?
02-21 21:05:46.586: D/webviewglue(14924): nativeDestroy view: 0x685300
02-21 21:05:46.586: I/Ads(14924): onFailedToReceiveAd(Invalid Google Ad request.)
I do not have a AdMob publisher ID yet, since this will be my first APP for the market (and I first have to have an APP on the market before I get an ID for the APP). What ID should I use? Currently I have (testing on my Android Phone):
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice("9B08CXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
//adRequest.addTestDevice("037c7xxxxxxxxxxx"); (Not right, is from console)
AdView adView = (AdView) this.findViewById(R.id.adView);
adView.loadAd(adRequest);
In my XML, I have (because it also warns about viewWidth?). It is packed in a bigger LinearLayout:
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="50dip">
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adSize="BANNER"
ads:adUnitId="@string/admob_pub_id"/>
</LinearLayout>
I hope the question is small enough, but still contains enough information.
Thanks in advance!
Kinds regards,
Jos.
EDIT: I do have the manifest file changed (add permissions, activity android:name=...,
android:configChanges=...). I added the jar to a lib-folder and added it to the libraries.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不需要市场上已有应用程序即可获取新应用程序的发布商 ID。在“添加站点/应用程序”表单上的 Android 包 URL 字段中,只需输入“market://details?id=your.package.name”。您当然需要将“your.package.name”替换为应用程序的实际包名称。
viewWidth 警告没有问题,在插入发布商 ID 后您可能仍然会看到它们。
You don't need to have an app already on the market to get a Publisher ID for a new app. In the Android Package URL field that's on the "Add Site/App" form, just enter "market://details?id=your.package.name". You'll of course want to replace the 'your.package.name' with your app's actual package name.
The viewWidth warnings are fine and you will likely still see them after inserting your Publisher ID.
参考以下错误:
您的广告单元 ID 是否正确?
Referring to the following errors:
Is your ad unit id correct?