Home » Android » android – AdMob error "you must have adactivity declared in androidmanifest.xml with configchanges"

android – AdMob error "you must have adactivity declared in androidmanifest.xml with configchanges"

Posted by: admin May 14, 2020 Leave a comment

Questions:

I’m trying to get AdMob in my android-app.
When i launch the emulator it says:

“you must have adactivity declared in androidmanifest.xml with configchanges”

There are a lot of topics about this but no one fixt the issue.

Please help me out!

Greetz, Jasper….

How to&Answers:

A proper Admob Activity in your AndroidManifest definition looks like this:

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

You are probably missing the android:configChanges part.

Note that all the configChanges parameters are required. Since not all of them exist/are allowed in older SDKS, you need to use a more recent Android version as your default build platform. You will still be able to target older Android versions if you set your minSdk properly and do not use any newer API calls in your code though.

Answer:

What worked for me was to change the Android SDK version to 13 and expand the android:configChanges in the manifest to contain all parameters:

android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"

NOTE: The configChanges content is case-sensitive so make sure you preserve camelCase! (This bit me in the beginning)

I started receiving ad’s within a minute or so.

Answer:

a very good tutorial, here :
http://jmsliu.com/209/add-google-admob-in-android-application.html

Answer:

Set your Build Target to latest you have (>=4) it will work.
You can still have minSdkVersion, targetSdkVersion as you like.

The ad will appear after a while, be patient 🙂