0

I have looked at similar questions and did all the suggestions and I am still getting this message on my phone: "You must have AdActivity declared in AndroidManifest.xml with configChanges".

Here is what I have in the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="..." android:versionCode="1" android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17"/>
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name"   android:allowBackup="true">
<activity android:name="..." android:label="@string/app_name">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
  </intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode"/>    
<service android:enabled="true" android:name="..." />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest> 

Is there anything else that I should do? Please note: I have looked at other similar questions, and none of the answers solves my problem. Thanks for the help.

TJ1
  • 7,578
  • 19
  • 76
  • 119
  • You are missing quite a few (well, just the two really) in those attributes. `android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" >` – Siddharth Lele May 03 '13 at 04:39
  • possible duplicate of [Admob implementation Error](http://stackoverflow.com/questions/7947165/admob-implementation-error) – Siddharth Lele May 03 '13 at 04:41
  • @IceMAN I tried adding `screenSize|smallestScreenSize` but now I get error. – TJ1 May 03 '13 at 04:42
  • Here is the error I get: `error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode| screenSize|smallestScreenSize').` – TJ1 May 03 '13 at 04:44
  • Guys I know this is a similar question to other questions, but the solutions for those did not resolve my problem. – TJ1 May 03 '13 at 05:03
  • you have to set your project build target to Android 3.2 or higher – Linga May 03 '13 at 05:07
  • set target in default.properties to android-13 – Linga May 03 '13 at 05:09

1 Answers1

6

Change your manifest to

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

also,

you have to set your project build target to Android 3.2 or higher .

Note:

Don't forget these two permissions in your manifest

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

Refer this tutorial

Read documentation

Linga
  • 10,379
  • 10
  • 52
  • 104
  • As soon as I add: `screenSize|smallestScreenSize` I get error. – TJ1 May 03 '13 at 04:51
  • you didn't follow my answer, see configChanges. You need to have all the 7 items – Linga May 03 '13 at 04:58
  • as I said above when I add `screenSize|smallestScreenSize` I get error. I have reported the error I get above. – TJ1 May 03 '13 at 05:01
  • 1
    right click on the project folder in eclipse->properties->choose android->choose firmware 3.2 or higher – Linga May 03 '13 at 05:06
  • 1
    Thanks, I did that and error is gone but I also don't see any Ad block on the screen now. Also my device is Android 2.3.4, is that Ok that I choose Android 4.2.2 in the properties? – TJ1 May 03 '13 at 05:15
  • my sdk is the latest, I meant the phone that I have has Android 2.3.4. Will that still work? why I don't see the Ad banner now? – TJ1 May 03 '13 at 05:19
  • sorry. I don't know about that, are you able to see Ad banner in emulator? – Linga May 03 '13 at 05:21
  • SO, the problem may be in your phone because of Android 2.3.4, but i'm not sure about this – Linga May 03 '13 at 05:26
  • So my build target cannot be lower than 3.2? – TJ1 May 03 '13 at 05:28
  • Yes, don't forget. uiMode supported in 3.2 – Linga May 03 '13 at 05:29
  • This means AdMob is not going to work for versions below 3.2? – TJ1 May 03 '13 at 05:30
  • As far i know, yes. I'm always set the latest versions for all the projects. So i didn't faced this issue – Linga May 03 '13 at 05:31