Android 分析XML时出错:使用admob ad的未绑定前缀

Android 分析XML时出错:使用admob ad的未绑定前缀,android,Android,我的工作布局如下所示: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="match_parent" android

我的工作布局如下所示:

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

    <com.google.ads.AdView android:id="@+id/adView"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         ads:adUnitId="ca-app-pub-xxx/xxx"
                         ads:adSize="BANNER"
                         ads:testDevices="TEST_EMULATOR, xxx"
                         ads:loadAdOnCreate="true"/>

</LinearLayout>

现在,我要删除LinearLayout:

<?xml version="1.0" encoding="utf-8"?>
<com.google.ads.AdView android:id="@+id/adView"
                         android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         ads:adUnitId="ca-app-pub-9000079580883391/8483250253"
                         ads:adSize="BANNER"
                         ads:testDevices="TEST_EMULATOR, 4FBD7E211FFFF7D7"
                         ads:loadAdOnCreate="true"/>

那我就要面对错误了。我知道我需要添加
xmlns:ads=”http://schemas.android.com/apk/lib/com.google.ads“
但我不知道在哪里

xmlns:android=”http://schemas.android.com/apk/res/android"
xmlns:ads=”http://schemas.android.com/apk/lib/com.google.ads“
将这两个都添加到您的Adview中

同时使用

xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads



xmlns:ads="http://schemas.android.com/apk/res/com.your.packagename
像这样

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                 xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
                 android:layout_width="fill_parent"
                 android:layout_height="fill_parent"
                 android:id="@+id/main_layout">

    <com.google.ads.AdView android:layout_width="fill_parent"
                           android:layout_height="wrap_content"
                           android:id="@+id/adMob"
                           android:layout_alignParentBottom="true"
                           ads:adUnitId="YOUR AdMob publisher ID"
                           ads:adSize="BANNER"/>
</RelativeLayout>


添加到布局中的根视图,因此我需要将其添加到其他文件中?然后错误仍然会出现在eclipseyou必须添加xmlns:android=”“xmlns:ads=”“lines即使谷歌的示例代码也没有这些xmlns属性。干得好