Android上的Google AdMob错误

1 android ads admob android-layout

我使用的是Android的AdMob SDK的4.3.1和我使用XML来创建布局作为解释这里使用Eclipse IDE中.问题是eclipse无法识别com.google.ads.AdView标记并给出错误错误:解析XML时出错:未绑定的前缀.我该如何解决?

编辑 -这是布局文件的代码

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<com.google.ads.AdView android:id="@+id/adView"
                     android:layout_width="wrap_content"
                     android:layout_height="wrap_content"
                     ads:adUnitId="MY_AD_UNIT_ID"
                     ads:adSize="BANNER"
                     ads:testDevices="TEST_EMULATOR,e78b974e6ab65648b52951e69edcb571"
                     ads:loadAdOnCreate="true"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

erd*_*ter 8

只需添加 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" to the layout!