3

After my previous question I have managed to Add and Ad banner to my App, But when i run it in simulator or phone, in the ad banner it says

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

In my manifest i have...

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

which was copied from the downloaded example....

If i follow the instructions from Admob..the manifest should like this...

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

The manifest has an error and will not save..? It says string types not allowed?

Below is the code for full maifest, this is the one that has the error...

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="org.coopersoft.ELcalcV"
  android:versionCode="5"
  android:versionName="1.1">
<application android:icon="@drawable/icon" android:label="@string/app_name">

    <activity android:name=".ELcalcV"
              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=".Help"
     android:label="@string/help_title" >
    </activity>

    <activity android:name=".About"
     android:label="@string/about_title" 
     android:theme="@android:style/Theme.Dialog">     
    </activity>

    <activity android:name=".CalcV"
     android:label="@string/calc_title">     
    </activity>

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

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

2
  • Please Could you paste the entire AndroidManifest.xml ?
    – Ivan
    Jan 7, 2012 at 16:46
  • Yeah...you have the same problem as I had. Try to solve as I have done.
    – Mun0n
    Jan 7, 2012 at 17:27

3 Answers 3

5

I have the same problem as you, and I solved it as follows.

Change the Android target to 3.2. If you are using Eclipse, go to the properties in your project and in the Android option put the Project Build Target to 3.2. This will solve the problem and the error will dissapear.

6
  • 1
    I don't think this is a solution, since if you change the android target, in fact if you use an higher build target your project should not run on older devices. Consider that 3.2 version is quite new. And also my projects with eclipse indigo are with build target of 2.2 and compile fine, then probably the problem is another. Maybe the problem is different.
    – Ivan
    Jan 7, 2012 at 17:03
  • 1
    That is not correct. You only change the Android target not the minimum SDK version. It works for me, I am working in an app on 2.3.5 devices and my ads works pretty fine.
    – Mun0n
    Jan 7, 2012 at 17:11
  • 2
    Ok it is not correct, but i suppose the problem is another, since i'm using an older version as android target and admob is working fine (withoun any change on build target)! I think the problem is another. I don't know what problem, since the question has has a lack of informations.
    – Ivan
    Jan 7, 2012 at 17:15
  • 1
    That is possible. I have the same problem that he says and I solved it doing this...
    – Mun0n
    Jan 7, 2012 at 17:17
  • 1
    Ok it is correct :) the newest version need the build target set to 3.2 i'll upvote your answer.
    – Ivan
    Jan 7, 2012 at 17:25
3

I suggest you to check these questions: AdMob can't display ads because of configChanges

Admob Error in Eclipse for android:configChanges

And also the admob page http://code.google.com/intl/it-IT/mobile/ads/docs/android/fundamentals.html#requirements

And as it said on that page

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).

5
  • Changed the build to 3.2 and all errors have gone...however, when i now run the App, the banner does not show at all. Whereas before it showed a banner containing the error text...When i check the graphical layout in eclipse it shows the banner so the layout is correct..Any Ideas??? Thanks
    – Coops5575
    Jan 8, 2012 at 12:37
  • 1
    Consider that 1. when you start your admob application for the first time it could take at least 24h, 2. The ad are not shown always. It depends on how many request your app send to the adserver, many requests more chance to see the ad. Btw You can debug your application and check if the ad request is correctly sent tho the ad server.
    – Ivan
    Jan 8, 2012 at 13:16
  • 1
    Did you put the correct ID USER? Are you using a device or the emulator.There are some tutorials in the Admob's Google code page to make some test
    – Mun0n
    Jan 8, 2012 at 16:30
  • Yeah got the correct user Id as when i check AdMob my Apps are making requests.
    – Coops5575
    Jan 9, 2012 at 7:44
  • Consider that one of my apps that has only 400 installations gives me an ad once every 20/40 start.
    – Ivan
    Jan 9, 2012 at 10:28
2

Everything finally working ok now...

I had Padding set in my Linear Layout to 20 dp. Think this is what prevented the ads from showing. My apps are tested on a HTC wildfire to be sure the apps work ok on other phones.

With the padding set,the screen resolution was too small to show the Ads.

Now when Apps are run, ads appear within 10 - 15 seconds, network connection permitting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.