Admob with Android: unable to parse android:configChanges in manifest - android

I am trying to add ads to my Android app using Admob, but have hit a brick wall. Admob says it requires the following from logcat
E/Ads (26043): The android:configChanges value of the com.google.ads.AdActivity must include uiMode.
E/Ads (26043): The android:configChanges value of the com.google.ads.AdActivity must include screenSize.
E/Ads (26043): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.
However, the Android SDK in Eclipse on Ubuntu fails to be able to parse the following,
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
When I go to the activity and select the attribute in the manifest, the last three items show 'Unrecognized flag'.
I want to add ads in on Android 1.6 (API level 4), but these attributes don't exist until API levels in the teens. How do I reconcile this?

The AdMob SDK v4.3.1 was released late last night. The SDK requires these new configChanges for tablet optimization, but these configChanges are only available in Honeycomb and above.
You will need to download Android SDK Version 3.2 or above, and then set target=13 or above in your project.properties file to compile against the new SDK version. It will still support Android 1.5 devices and above, and that can be controlled by the minSdkVersion in your manifest.

Related

Building MAUI Android Failing

I created a brand new MAUI app (I had to create a new app as the previous app I'd created with a preview version didn't work when I upgraded Visual Studio preview). This app is using prism.maui which shouldn't make any difference and I'm also using a class library built with the preview version.
My app runs fine with Windows so I have no concern that I have issues with the app. I have also cleared out the obj folder multiple times with no joy.
When I build Android I get the following error message:
Error AMM0000
uses-sdk:minSdkVersion 19 cannot be smaller than version 21 declared in library D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\lp\164\jl\AndroidManifest.xml as the library might be using APIs not available in 19
Suggestion: use a compatible library with a minSdk of at most 19,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="androidx.security" to force usage (may lead to runtime failures)
Money.App D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\AndroidManifest.xml 35
I know how to fix this - but even when I do I get a further issue:
AMM0000
Attribute application#appComponentFactory value=(androidx.core.app.CoreComponentFactory) from AndroidManifest.xml:24:18-86
is also present at AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:11:3-33:17 to override.
Money.App D:\Code\AzureDevops\BootCom.Money.Xamarin\App\Money.App\obj\Debug\net6.0-android\AndroidManifest.xml 24
I really don't know where to go from here. I've recreated this app now 3 times and if this is how it needs to work for MAUI I need to go back to using Xamarin.
Please help!
I had the same error after I added a package name via the properties of the project.
As a consequence of adding the package name via the options of the project, the AndroidManifest.xml package attribute was updated, wich is what is expected, but there was also a tag that was being added, wich was unwanted.
The tag was the following:
<uses-sdk />
After removing this tag everything worked again.
Go to androidManifest.xml file
add: uses-sdk android:minSdkVersion="21" if not exist
otherwise update uses-sdk section to uses-sdk android:minSdkVersion="21"
That solves my problem

Admob error android:configChanges in Eclipse and Device

Eclipse is giving me an error on the android:configChanges line in my AndroidManifest.xml:
"< activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize">"
the error is:
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
If I leave only keyboard|keyboardHidden|orientation there's no error, but compiler asks for the 4 remaining ones when I try and build. But there is no ads displayed.
I'm using GoogleAdMobAdsSDK-4.3.1.
If i set project.properties target-13.my android 2.3 device does not run the app..But my device run so many app that having ads are displayed..
Please Help me..!!!
you need do this:
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).
Check out this blog post. You need to set android-13 for 4.3.1 to compile, but you can use
<uses-sdk android:minSdkVersion="9"/>
or any version down to 3, and your app will then run on your 2.3 device.

Android Project build target greater than what it is meant to work for

In my android app I'm using admob and I was just about to integrate the last admob sdk (GoogleAdMobAdsSdk-4.3.1). After adding it to my project I had some runtime errors:
11-20 14:24:10.234: E/Ads(14268): The android:configChanges value of the com.google.ads.AdActivity must include keyboard.
11-20 14:24:10.234: E/Ads(14268): The android:configChanges value of the com.google.ads.AdActivity must include screenLayout.
11-20 14:24:10.234: E/Ads(14268): The android:configChanges value of the com.google.ads.AdActivity must include uiMode.
11-20 14:24:10.234: E/Ads(14268): The android:configChanges value of the com.google.ads.AdActivity must include screenSize.
11-20 14:24:10.234: E/Ads(14268): The android:configChanges value of the com.google.ads.AdActivity must include smallestScreenSize.
11-20 14:24:10.234: E/Ads(14268): You must have AdActivity declared in AndroidManifest.xml with configChanges.
And in the ad banner: "You must have AdActivity declared in AndroidManifest.xml with configChanges."
After searching the stackoverflow I've added all the configChanges above:
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
But now I have the error below:
Description Resource Path Location Type error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize'). AndroidManifest.xml line 22 Android AAPT Problem
Now to fix this I have to set the Project build target Android 3.2 (API Level 13) or above.
Can anyone tell me what does this imply? Will the app work well on all Android 2.1+ ?
Please note that before this, my project build target was Android 2.1, and my test device is Nexus S (2.3.6) on which the app is working well even after setting the build target to 3.2+.
Thanks in advance.
Everything will work fine even if you build against 3.2
What I do is leave it all on 3.2, then when I'm done coding it and ready to test, I switch it back down the minimum level that my app should support, I check for any errors that come up. (the one in the manifest will not matter). I do this because it's easy to miss accidentally adding 2.3 code when you want it to work on 2.1
Just remove everything after orientation, problem solved
android:configChanges="keyboard|keyboardHidden|orientation"
Google AdMob Ads SDK 4.3.1 requires you to compile against Android 3.2 or above (This means in your project.properties file you need to specify android-13 or higher). Your app will still run fine on 2.1+ devices; you just have to specify you support 2.1 in your manifest.
<uses-sdk android:minSdkVersion="7"/>

Google Admob Integration Errors

I am working on an app for Android 2.2 Platform, wanted to integrate admob into it, StackOverflow I set up an account downloaded the latest admob SDK and created an ad Layout in XML followed the instructions mentioned in docs. I have set the target in project properties to 1.4 and set the min SDK to 8. Now the error occurs when I configure
<activity Android:name="com.Google.ads.AdActivity" Android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
The String
keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize
wont compile for Android 2.2 it throws errors. However if I compile without these screenSize|smallestScreenSize, it compiles but the ad area in the app shows an error saying You must have AdActivity declared in AndroidManifest with configChanges
Can you guys suggest a solution, any help with this problem is appreciated.
The Google AdMob SDK v4.3.1 requires the additional config changes for optimization on tablets that are running apps with Google AdMob Ads. The configChanges screenSize and smallestScreenSize were not introduced until android-13, so therefore the Google AdMob SDK requires you to COMPILE against Android 3.2 or greater.
You can still make your app run on Android 2.2 devices/emulators by setting the minSdkVersion in your manifest:
<uses-sdk android:minSdkVersion="8" />
set target in project.properties to android-13 (Android v3.2)
not in manifest! (this is that I misunderstood)

Admob Error in Eclipse for android:configChanges

Eclipse is giving me an error on the android:configChanges line in my AndroidManifest.xml:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"></activity>
the error is:
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize').
If I leave only keyboard|keyboardHidden|orientation there's no error, but compiler asks for the 4 remaining ones when I try and build.
I'm using GoogleAdMobAdsSDK-4.3.1.
Any ideas?
EDIT: I got it working by changing my project.properties (default.properties on SDK's lower then 14) file to:
# Project target.
target=android-14
and in my SDK Manager having the SDK Platform Android 4.0 - Revision 14 installed.
It should also work for SDK Platform android 3.2 - revision 13, so you just have to change the project.properties target to android-13 if that is the case. Basically you just have to make sure that the SDK revision is 13 or above, and that you have that SDK installed in the SDK manager and the project target in default/project.properties pointing to it.
Easy solution: (and NO you don't need to to change the min-sdk value !!)
Step 1:
Change "project.properties" file
# Project target.
target=android-13
Step 2:
In Eclipse
Project > Clean... > (select your project) > Clean projects selected below > OK
For a complete explanation with real example use this tutorial http://www.monkeycoder.co.nz/Community/posts.php?topic=1121
Cheers !
Simple answer: the mentioned config changes are not support in Android 2.1, have a look here:
http://developer.android.com/guide/topics/manifest/activity-element.html#config
e.g. uiMode needs API Level 8.
From the official AdMob Documentation:
Requirements
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).
have a look here: https://developers.google.com/admob/android/quick-start
So I think your tools version is not updated to at least Version 13.
For those using Eclipse there is an easier way:
Right click your project folder in the left "Package Explorer" pane and click Properties -> Android -> and in the "Project Build Target" list check off API 13 or up.
Note: this is the same effect as editing project.properties which is auto-generated anyway.
This will build your project against the Android 3.2 SDK which includes the terms that were previously unrecognized.
You may leave your android:minSdkVersion and targetSdkVersion values the same in your Manifest.xml.
Be warned though, if you don't set your targetSdkVersion to API 12 or lower (or don't set it at all) the Android system will assume that the android:configChanges values screenSize and smallestScreenSize (which were introduced in API 13) are accounted for and thus will be allowed to destroy-restart your activity. If you wanted to avoid this you must include those terms in your other <activity> tags (which probably only had keyboard|keyboardHidden|orientation until now).
However, if your application targets API level 12 or lower, then your activity always handles this configuration change itself (this configuration change does not restart your activity, even when running on an Android 3.2 or higher device).
Quote is from here.
I had the same problem so I came here.
I have downloaded the sample code from https://developers.google.com/admob/android/quick-start, I still had the problem with all answers above so I used the same admob sdk, they offer in the sample project. Redo the build jars thing, changed target to android-15, and used the same line they use:
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
And it works!
Did you use
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|‌​screenSize|smallestScreenSize
or shorter one? If you change your target above 13 and use longer configChanges one (which I wrote), it should work.
Easy solution:
Change "project.properties" file to 21
# Project target.
target=android-21
All new Android apps created after October 14, 2011 will require an AdMob SDK that was released on or after March 15, 2011. This corresponds to version 4.0.2+ for Android. If you downloaded the library from our official download site, then you're already set. Otherwise you may have an old version of the AdMob SDK that was released prior to March 15, 2011, and your new app will not receive any ad impressions until you update your SDK.

Categories

Resources