Advise error parsing XML unbound prefix Android

I let AdMob work for a while. After the error, I made a mistake and scrapped the whole thing more than once. Now I get an error from XML that it can't be parsed correctly. This is the current code. I read other answers, but I can't seem to figure out what the problem is. If someone can look at my layout file and let me know what I did wrong, I would appreciate it very much. For my value, I directly use the code of AdMob website suitable for my own application

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

android:id="@+id/AdLinearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical" >

<!-- Ad Placeholder -->

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

<ScrollView
    android:id="@+id/BaseScrollView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <LinearLayout
        android:id="@+id/baseVerticalLinearLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/LinearLayoutH1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="left"
                android:text="@string/Sad" />

            <TextView
                android:id="@+id/textView2"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="right"
                android:text="@string/Happy" />
        </LinearLayout>

        <SeekBar
            android:id="@+id/happinessBarID"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:max="@integer/SliderMax"
            android:progress="@integer/SliderDefault" />

        <LinearLayout
            android:id="@+id/LinearLayoutH2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView3"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="left"
                android:text="@string/Tired" />

            <TextView
                android:id="@+id/textView4"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="right"
                android:text="@string/Awake" />
        </LinearLayout>

        <SeekBar
            android:id="@+id/energyBarID"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:max="@integer/SliderMax"
            android:progress="@integer/SliderDefault" />

        <LinearLayout
            android:id="@+id/LinearLayoutH3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView5"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="left"
                android:text="@string/Calm" />

            <TextView
                android:id="@+id/textView6"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="right"
                android:text="@string/AnxIoUs" />
        </LinearLayout>

        <SeekBar
            android:id="@+id/anxietyBarID"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:max="@integer/SliderMax"
            android:progress="@integer/SliderDefault" />

        <LinearLayout
            android:id="@+id/LinearLayoutH4"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView
                android:id="@+id/textView7"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="left"
                android:text="@string/No_Pain" />

            <TextView
                android:id="@+id/textView8"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="right"
                android:text="@string/Max_Pain" />
        </LinearLayout>

        <SeekBar
            android:id="@+id/painBarID"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:max="@integer/SliderMax"
            android:progress="@integer/SliderDefault" />

        <DatePicker
            android:id="@+id/datePicker1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <TimePicker
            android:id="@+id/timePicker1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <EditText
            android:id="@+id/noteTextFieldID"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10"
            android:hint="@string/Note_Hint"
            android:inputType="textMultiLine"
            android:maxLength="@integer/NoteLimit" />

        <Button
            android:id="@+id/enterButtonID"
            android:layout_width="132dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:onClick="dialogPop"
            android:text="@string/EnterButtonText" />
    </LinearLayout>
</ScrollView>

resolvent:

Change:

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

to

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

AdMob requires you to use the attributes defined in its package. Therefore, we don't have to enter the URL every time. We use xmlns to declare an XML namespace, just as we did for Android. You use Android instead of xmlns to prefix the declaration, which leads to your error

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>