简体   繁体   中英

How can I fix this unbound prefix error ? Don't know what I am Missing

<?xml version="1.0" encoding="UTF-8"?>

xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
package="com.app">

<com.admob.android.ads.AdView
    android:id="@+id/MainActivity"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="ca-app-pub-"
    android:name="com.admob.android.ads.AdView"/>
<com.admob.android.ads.AdView/>
</RelativeLayout>

code for my adview XML file

error: unbound prefix.

xmlns:android="http://schemas.android.com/apk/res/android"

Since you are trying to integrate AdMob, try to change:

xmlns:ads="http://schemas.android.com/apk/res-auto"

To this:

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

Also, you have a closing tag for a RelativeLayout that was never opened.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM