AdMob的:缺少所需的XML属性adUnitID [英] AdMob: Missing required XML attribute adUnitID

查看:541
本文介绍了AdMob的:缺少所需的XML属性adUnitID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的广告的东西,我不能得到它的工作。 我做了什么说在 HTTP ://$c$c.google.com/intl/nl-NL/mobile/ads/docs/android/banner_xml.html

I'm new to the ad stuff, and I can't get it working. I've done what's stated at http://code.google.com/intl/nl-NL/mobile/ads/docs/android/banner_xml.html.

这是我的main.xml:

This is my 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 /值attrs.xml:

This is my attrs.xml in res/values:

<?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>

出现以下错误,当我运行的应用程序:

The following error occurs when I run the app:

无效adSize放慢参数在XML布局:-1。默认为BANNER

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

AD浏览报失踪所需的XML属性adUnitId。

AdView missing required XML attribute adUnitId.

我是什么做错了吗?

推荐答案

若有谁与它的斗争可能会尝试的xmlns:广告=htt​​p://schemas.android.com/apk/lib/ com.google.ads

Anyone who still struggle with it may try xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads".

这篇关于AdMob的:缺少所需的XML属性adUnitID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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