AdMob missin adSize on Android

1

I want to add an adMob ad banner to my app and it tells me that the adSize attribute was missin but it's all apparently correct:

My XML code:

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

<com.google.android.gms.ads.AdView
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentBottom="true"
    ads:adUnitId="@string/banner_ad_unit_id"
    ads:adSize="BANNER" />



<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.design.widget.FloatingActionButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:clickable="true"
            app:fabSize="normal"
            app:srcCompat="@android:drawable/ic_menu_close_clear_cancel"
            android:id="@+id/btnSalir"
            android:layout_marginRight="14dp"
            android:layout_marginEnd="14dp"
            android:layout_marginBottom="14dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true"
            app:backgroundTint="@android:color/holo_blue_dark"
            app:elevation="17dp" />

    </RelativeLayout>

    <Button
        android:text="CUENTOS INFANTILES"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btnCuentos"
        style="@style/Widget.AppCompat.Button.Colored"
        android:backgroundTint="@android:color/holo_blue_dark" />

    <Button
        android:text="APRENDE INGLES CON AUDIOCUENTOS (PROXIMAMENTE)"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/btnIngles"
        style="@style/Widget.AppCompat.Button.Colored"
        android:layout_below="@+id/btnCuentos"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:backgroundTint="@color/colorPrimaryDark" />

</RelativeLayout>

    
asked by Juanma Perez 01.02.2017 в 22:52
source

1 answer

1

You need to add the namespace to recognize that property.

In fact I think this is not necessary:

xmlns:ads="http://schemas.android.com/tools"

Add these two:

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

or

<LinearLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    
answered by 01.02.2017 в 23:46