Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Admob Error in Eclipse for android:configChanges

Easy solution: (and NO you don't need to to change the min-sdk value !!)

Step 1: Change "project.properties" file

# Project target.
target=android-13

Step 2: In Eclipse

Project > Clean... > (select your project) > Clean projects selected below > OK

For a complete explanation with real example use this tutorial http://www.monkeycoder.co.nz/Community/posts.php?topic=1121

Cheers !


Simple answer: the mentioned config changes are not support in Android 2.1, have a look here:

http://developer.android.com/guide/topics/manifest/activity-element.html#config

e.g. uiMode needs API Level 8.

From the official AdMob Documentation:

Requirements

The Google AdMob Ads SDK for Android requires Android 1.5 or later. Make sure you have the latest copy of the Android SDK and that you're compiling against at least Android v3.2 (set target in default.properties to android-13).

have a look here: https://developers.google.com/admob/android/quick-start

So I think your tools version is not updated to at least Version 13.


For those using Eclipse there is an easier way: Right click your project folder in the left "Package Explorer" pane and click Properties -> Android -> and in the "Project Build Target" list check off API 13 or up.

Note: this is the same effect as editing project.properties which is auto-generated anyway.

This will build your project against the Android 3.2 SDK which includes the terms that were previously unrecognized.

You may leave your android:minSdkVersion and targetSdkVersion values the same in your Manifest.xml.

Be warned though, if you don't set your targetSdkVersion to API 12 or lower (or don't set it at all) the Android system will assume that the android:configChanges values screenSize and smallestScreenSize (which were introduced in API 13) are accounted for and thus will be allowed to destroy-restart your activity. If you wanted to avoid this you must include those terms in your other <activity> tags (which probably only had keyboard|keyboardHidden|orientation until now).

However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).

Quote is from here.


I had the same problem so I came here.
I have downloaded the sample code from https://developers.google.com/admob/android/quick-start, I still had the problem with all answers above so I used the same admob sdk, they offer in the sample project. Redo the build jars thing, changed target to android-15, and used the same line they use:

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

And it works!