tran minh
tran minh

Reputation: 1

I can't use adMob in my App

When I add the code

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#F0F8FF"
    android:orientation="vertical" >
<ListView
    android:id="@+id/lvHienThi"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >
</ListView>

<com.google.android.gms.ads.AdView
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adview"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|center"
    ads:adSize="BANNER"
    ads:adUnitId="@string/ad_unit_id" />

it show me :"No resource identifier found for attribute 'adSize' in package '....'" How can I fix it ? Please help me. Thank you !

Upvotes: 0

Views: 86

Answers (2)

Kenny C
Kenny C

Reputation: 2289

instead of

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

add

xmlns:ads="http://schemas.android.com/apk/res/your.package.name"

replacing "your.package.name" with your actual package name

Upvotes: 1

Sasi Kumar
Sasi Kumar

Reputation: 13278

Replace /res/ with /lib/ in your custom layout nampespace

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

will be

 xmlns:yourApp="http://schemas.android.com/apk/lib/com.yourAppPackege.yourClass"

i hope it help :)

Upvotes: 1

Related Questions