Shruti
Shruti

Reputation: 5591

Admob on android : missing xml attribute

I am adding admob adview in my android application's activity :

my code is :

in xml file :

<Linearlayout 
>
<Button />
<Button />
<com.google.ads.AdView
            xmlns:ads="http://schemas.android.com/apk/res/com.sos.emergency"
            android:id="@+id/adView"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            ads:adSize="BANNER"
            ads:adUnitId="publisherid" />
</Linearlayout>

in my activity :

AdView adview = (AdView)findViewById(R.id.adView);
        adview.loadAd(new AdRequest());
        adview.setAdListener(this);

And now i am getting following error :

Logcat :

  02-13 12:03:42.784: E/Ads(271): The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.
02-13 12:03:42.784: E/Ads(271): The android:configChanges value of the com.google.ads.AdActivity must include uiMode.
02-13 12:03:42.784: E/Ads(271): The android:configChanges value of the com.google.ads.AdActivity must include screenSize.
02-13 12:03:42.784: E/Ads(271): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.
02-13 12:03:42.784: E/Ads(271): You must have AdActivity declared in AndroidManifest.xml with configChanges.

And in my manifest file i have added following :

<activity
            android:name="com.google.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation" />

please tell me where i need to edit the code to show ads on my application.

Please see the screen shot of adview it is showing

You must have AdActivity declared in AndroidManifest.xml with configChange

ScreenShot

Upvotes: 0

Views: 1641

Answers (1)

RajPara
RajPara

Reputation: 2281

Are you using the new version of the AdMob SDK (4.3.1)? If you are, you're activity would probably have some extra items under configChanges as below:

<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>

Also, if you do this and you don't have the target set in your project.properties file (probably need to set target=android-13 or higher assuming you have an Android SDK of 3.2 or higher).

Found this info in a blog post here.

Upvotes: 2

Related Questions