gpt4 book ai didi

android - AdMob:缺少必需的 XML 属性 adUnitID

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:20:53 25 4
gpt4 key购买 nike

我是广告方面的新手,我无法让它发挥作用。我已经完成了 http://code.google.com/intl/nl-NL/mobile/ads/docs/android/banner_xml.html 中所述的操作.

这是我的 main.xml:

<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="com.niek.runningapp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#FFFFFF"
android:stretchColumns="1">
<!-- more stuff-->
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a14da18492dd1f0"
ads:adSize="BANNER" />
</TableRow>
<!-- More stuff -->

这是我在 res/values 中的 attrs.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="com.google.ads.AdView">
<attr name="adSize">
<enum name="BANNER" value="1"/>
<enum name="IAB_MRECT" value="2"/>
<enum name="IAB_BANNER" value="3"/>
<enum name="IAB_LEADERBOARD" value="4"/>
</attr>
<attr name="adUnitId" format="string"/>
</declare-styleable>
</resources>

运行应用程序时出现以下错误:

Invalid adSize paramter in XML layout: -1. Defaulting to BANNER

AdView missing required XML attribute adUnitId.

我做错了什么?

最佳答案

任何仍在为此苦苦挣扎的人都可以尝试 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"

关于android - AdMob:缺少必需的 XML 属性 adUnitID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5613398/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com