Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AdMob in android "AdView missing required XML attribute 'adSize' "

I am trying to implement AdMob in my Application. But dont know somehow its showing this error and my R.java file is not being generated due to it. I have tried all the ways to solve this problem, like Clean,Build, Build All. But non is working for me. Following my code snippet in which its showing error "Error in parsing XML: Unbound prefix"

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:background="@color/bgcolor">

<LinearLayout
android:id="@+id/Linearlayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<com.google.ads.AdView android:id="@+id/adView"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         ads:adSize="BANNER"
                         ads:adUnitId="XXX"
                         ads:refreshInterval="60"/>


</LinearLayout>

Please help me out. I am stuck here :(

like image 992
YuDroid Avatar asked Nov 27 '22 22:11

YuDroid


2 Answers

Probably a namespace issue. You have to define the namespace.

try adding

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

like image 109
Eren Tantekin Avatar answered Nov 30 '22 11:11

Eren Tantekin


New Admob SDK (Google Play services) requiried another namespace

xmlns:ads="http://schemas.android.com/apk/res-auto"
like image 24
itvdonsk Avatar answered Nov 30 '22 12:11

itvdonsk