java - 解析 XML 时出错 : unbound prefix Admob

标签 java android admob

我在尝试添加 Admob 时遇到布局问题。

<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads ="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools" 

android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="@drawable/lined2"
tools:context=".MainActivity" >

    <com.google.ads.AdView
    android:id ="@+id/adview"
    android:layout_width="fillparent"
    android:layout_height="wrap_content"
    ads:adUnitId="My ID"
    ad:adSize="BANNER"
    ads:testdevices="TEST_EMULATOR"
    ads:loadAdOnCreate="true" />

所以错误在这一行:

 <com.google.ads.AdView

它说:

Error parsing XML:unbound prefix 

我真的搜索了很多帖子,但没有人帮助我...... 我已经添加了 add xmlns:ads .... 但它没有帮助:/ 我忘了某事吗? ?

感谢您的帮助!

最佳答案

您在 adSize 的命名空间中遗漏了 s

改变

ad:adSize="BANNER"

ads:adSize="BANNER"

关于java - 解析 XML 时出错 : unbound prefix Admob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21753702/

相关文章:

java - 在 JSP EL 中连接字符串?

java - 将自定义布局添加到 ListView 行

Android AdMob 和 Maven

ios - Admob 没有显示任何广告

ios - AdMob 与 Cocos2d v3

java - 我如何将 Xuggler 与 Play 结合使用!框架

java - 哪些操作保持顺序

android HEX 颜色在某些设备上不起作用

java - 未找到 Android NDK 方法...从 C++ 调用 Java

android - 钛模拟器打不开