我通过在设备上运行Admob来尝试在我的应用中使用Admob,它没有显示任何内容,我在logcat中发现了以下错误
04-07 10:49:05.570: ERROR/Ads(1084): AdView missing required XML attribute adUnitId. 在attrs.xml文件中,我有以下几行
<?xml version="1.0" encoding="utf-8"?>
<declare-styleable name="com.google.ads.AdView">
<attr name="backgroundColor" format="color" />
<attr name="primaryTextColor" format="color" />
<attr name="secondaryTextColor" format="color" />
<attr name="keywords" format="string" />
<attr name="refreshInterval" format="integer" />
</declare-styleable>
我的错误是..。
我在我的应用程序中总共有4个活动,我正在尝试将admob添加到我的第四个活动中。无论我是否必须添加上述行与该活动或任何其他请帮助我的朋友们…
发布于 2012-03-05 20:05:22
我按照上面说的here进行了操作,它成功了。(在我问这个问题之前很长一段时间,我没有成功地回答任何一个问题,当我现在尝试它时,它起作用了……)
发布于 2011-04-07 16:52:07
应该是(使用'<'resources'>‘):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.admob.android.ads.AdView">
<attr name="backgroundColor" format="color" />
<attr name="primaryTextColor" format="color" />
<attr name="secondaryTextColor" format="color" />
<attr name="keywords" format="string" />
<attr name="refreshInterval" format="integer" />
</declare-styleable>
</resources>https://stackoverflow.com/questions/5577958
复制相似问题