After updating to Admob 4.3.1 I saw this instead of ads – “You must have AdActivity declared in AndroidManifest.xml with configChanges.”
If you’ve just updated Admob and begun using GoogleAdMobAdsSdk-4.3.1.jar, then you might have seen this as well. Luckily, this can be solved – read on.
So what does that message mean? I have declared the AdActivity in my manifest.
Admob instructions to the rescue… sort of
Well, they actually changed the required lines. You now need to include some new flags, making your new declaration:
<activity android:name=”com.google.ads.AdActivity” android:configChanges=”keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize”/>
Ok, that sounds fine. Copy…Paste… and now we have errors.
One thing leads to another
Your XML is now broken. You’re welcome.
So, the new required flags are actually only available in Android 3.2 and above. Specifically, uiMode is available in API 8, and the last two flags are only in API 13.
You might be thinking what I was – my app targets Android 2.x predominantly and it’s rather foolish that Admob expects you to be using 3.2 and above. However, your app is still perfectly usable in the same versions of Android as it was before.
Just go into the project properties and change the build target to 13 or above, and everything should now work.
Working Admob ads in 4.3.1
Test your app, and your ads should now show up. Congratulations, you just made it all the way back to where you started before you updated Admob.
If you need a little more background information, check out these two threads on StackOverflow:
http://stackoverflow.com/questions/7947165/admob-implementation-error
http://stackoverflow.com/questions/7902121/admob-cant-display-ads-because-of-configchanges
Other thoughts – reasons to upgrade
While you could probably stick with an older version of Admob for now, I don’t suggest it. Admob has stated that no new apps will see ads unless they’re on 4.0.2 or higher, and you can bet that they’ll keep trying to get rid of old SDK use.
I found that Mobclix wants people to update as well so they can use the android:hardwareAccelerated property. Eventually, something will happen and you’ll be forced to update your build target anyway, so you might as well embrace it.
On that subject, if you’re looking to move to a new ad network check out my series of articles on ad revenue.
One caveat – your build target is now higher, and Eclipse (or whatever environment you use) will no longer protect you from making API calls higher than your desired build target. You’ll have to exercise some self control, additional testing, or simply drop the build target down occasionally to double-check your project.
That’s it – you should now be past the problem with AdActivity configChanges with Admob 4.3.1.