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"/>

Eric Leichtenschlag
  • 8,881
  • 1
  • 28
  • 28
Coops5575
  • 431
  • 2
  • 5
  • 16

3 Answers3

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.

Ivan
  • 4,186
  • 5
  • 39
  • 72
Mun0n
  • 4,438
  • 4
  • 28
  • 46
  • 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 07 '12 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 07 '12 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 07 '12 at 17:15
  • 1
    That is possible. I have the same problem that he says and I solved it doing this... – Mun0n Jan 07 '12 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 07 '12 at 17:25
  • I've 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 the banner would show but contain error text about config changes.????? – Coops5575 Jan 08 '12 at 11: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).

Community
  • 1
  • 1
Ivan
  • 4,186
  • 5
  • 39
  • 72
  • 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 08 '12 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 08 '12 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 08 '12 at 16:30
  • Yeah got the correct user Id as when i check AdMob my Apps are making requests. – Coops5575 Jan 09 '12 at 07:44
  • Consider that one of my apps that has only 400 installations gives me an ad once every 20/40 start. – Ivan Jan 09 '12 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.

Mun0n
  • 4,438
  • 4
  • 28
  • 46
Coops5575
  • 431
  • 2
  • 5
  • 16