Channa
Channa

Reputation: 3737

Android - AdView missing required XML attribute 'adSize' when trying to add admob

My layout xml says missing XML attribute 'adSize'. here is my layout xml Can anyone help me to figure out what I am doing wrong here. I tried severel methods that are described for this type of questions, but no luck.

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:baselineAligned="false"
    android:layout_weight="1">
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical" >
        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/close" 
            android:onClick="dbcheck2"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical" >
        <Button
            android:id="@+id/button2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:onClick="startShowMeaningService"
            android:text="@string/startapp" />
    </LinearLayout>
</LinearLayout>
<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="@string/banner_ad_unit_id">
    </com.google.android.gms.ads.AdView>
</LinearLayout>

Upvotes: 0

Views: 629

Answers (1)

Fahim
Fahim

Reputation: 12358

you have missed the namespace

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

Upvotes: 2

Related Questions