Click here to Skip to main content
15,911,139 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    tools:context=".MainActivity">

    <!-- Sample AdMob App ID: Edited out ID -->
    <meta-data
        android:name="com.google.android.gms.ads.APPLICATION_ID"
        android:value="[ADMOB_APP_ID]"/>


    <com.google.android.gms.ads.AdView
    android:id="@+id/adview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adSize="BANNER"
    ads:adUnitId="Edited out ID"
    com.google.android.gms.ads.AdView/>


</RelativeLayout>


What I have tried:

I am at a loss how to fix this, it says "=" expected at com.google.android.gms.ads.AdView/>
Posted
Updated 9-Feb-19 4:38am

1 solution

Look at the second to last line of that XML you posted.
com.google.android.gms.ads.AdView

That's not a valid attribute. In fact, it looks like that line should not even be there, except for the "/>" part of it.

XML attributes are always of the format name="value".
 
Share this answer
 
v3
Comments
Keith.Harrie 13-Feb-19 11:50am    
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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>



error: unbound prefix.
Dave Kreskowiak 13-Feb-19 12:18pm    
You REALLY need to teach yourself about XML and how to recognize what is well-formed and mal-formed if you're going to do this stuff.

This should be fixed, but I don't know for sure because I don't do AdSense:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
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"/>
</RelativeLayout>

The problem is you didn't remove the line I told you to remove.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900