Admob for Android gives error on AdActivity android:configChanges

After experimenting with Admob for Android, I came across an error with the example code that can be downloaded from the developer site about advertising.

The error Eclipse gave me, was:

You must have AdActivity declared in AndroidManifest.xml with configChanges.


and that android:configChanges had to include screenLayout, uiMode, screenSize and smallestScreenSize.

After modifying the AdActivity tag in the Manifest file, from:

android:name="" android:configChanges="keyboard|keyboardHidden|orientation"  

to including the missing config parameters:


I then got another error at the AdActivity, saying:

Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').

All permissions and everything was set up right in the code example, except for the project build target.

Apparently, some of the required parameters, are not supported in Android API versions lower than 13, but the build target specified in the example project, is set to API level 8.

So, open the file, and change target=android-8 to target=android-13 (or higher).

The example project should now be compiling and working properly, and displaying ads as expected.


If Eclipse is still complaining about the last error, re-save the manifest file, or just restart Eclipse.

Ps: Remember to use your own admob_id in the strings.xml file.

comments powered by Disqus