• Hello everyone,

    We're happy to announce that our forum is back online! We needed to take some time off to discuss and decide on how to handle sensitive topics in our community.

    The team has posted an in-depth comment regarding a recent incident and our stance on politics and sexuality in our forum. We also added a dedicated paragraph about this in the forum guidelines. This is part of our commitment to maintain a welcoming and inclusive environment for all our users. Your understanding and continued support in building a creative and respectful community are highly appreciated.

    Thank you, the CX Dev-Team

Admob compiling challenge

Tom King

New member
Apr 2, 2018
Anyone struggling with the following when compiling using Admob? (I used the how-to at https://www.cerberus-x.com/community/index.php?threads/android-ads.1440/ which was helpful, but didn't mention this particular challenge).

Suspect a tweak to AndroidManifest.xml is needed, but I can't figure it!

Task :app:processReleaseMainManifest FAILED

Attribute activity#com.google.android.gms.ads.AdActivity@configChanges value=(keyboard keyboardHidden orientation screenLayout uiMode screenSize smallestScreenSize) from AndroidManifest.xml:38:5-44:24

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

is also present at [com.google.android.gms:play-services-ads-lite:20.2.0] AndroidManifest.xml:50:13-122 value=(keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize).

Suggestion: add 'tools:replace="android:configChanges"' to <activity> element at AndroidManifest.xml:38:5-44:24 to override.

> Task :app:mergeReleaseResources

11 actionable tasks: 11 executed

FAILURE: Build failed with an exception.
I can look into this today or tomorrow. Did you try the suggestion from the error message?
I can look into this today or tomorrow. Did you try the suggestion from the error message?
I did, but couldn't figure where to put the tools:replace bit.. whereever I tried, I just got a futher error. (Will post that)
So, the Androidmanifest.xml I changed was in the build folder, in the 'gradletemplate\app\src\main' subfolder. I wasn't sure if that was the right one to try modifying. Anyhow, when I added the


bit to the file, I got different errors.

I tried adding, thus:


but on compile, I got a different error:

com.android.manifmerger.ManifestMerger2$MergeFailureException: org.xml.sax.SAXParseException; lineNumber: 28; columnNumber: 42; The prefix "tools" for attribute "tools:replace" associated with an element type "activity" is not bound

At which point I was stuck!
I'm not that good with Admob so I asked GPT.. it seemd pretty Confident about what the error was, so maybe it can be of guidance?

"The error you're encountering is related to a conflict in the AndroidManifest.xml file of your Android app, specifically with the configChanges attribute for the AdActivity from the AdMob library and the AdActivity from the com.google.android.gms:play-services-ads-lite library.
To resolve this issue, you can add the tools:replace="android:configChanges" attribute to the <activity> element in your app's AndroidManifest.xml file, as suggested in the error message. Here's what you should do:
Open your app's AndroidManifest.xml file.
Locate the <activity> element related to the AdMob AdActivity, which should look something like this:
android:theme="@android:style/Theme.Translucent" />
Add the tools:replace attribute to that <activity> element as follows:

tools:replace="android:configChanges" />

Save the AndroidManifest.xml file.

Rebuild your project.

This should resolve the manifest merger conflict and allow your project to build successfully. If you have multiple <activity> elements with conflicting attributes, you may need to add the tools:replace attribute to all of them as needed.
After making these changes, try building and running your project again. If you encounter any further issues, make sure you have the latest versions of the AdMob and Google Play services libraries, as they sometimes release updates that can resolve compatibility problems."
@Wingnut I think that is what he already tried.

It seems I found a quick fix:
Change the following line in modules/brl/admob.cxs like so:
    #ANDROID_MANIFEST_APPLICATION+="<activity android:name=~qcom.google.android.gms.ads.AdActivity~q  />"
Edit: Revert to the original state of the manifest. No change needed there!
It could happen to produce other issues with scaling but here it shows some test ads with the admobtest example.

I will look into updating Admob to the latest version soon and while doing that I will check the overall implementation if it matches the android docs.
Aha, that compiled and produced a .apk - will check if the ads show :)

Thanks, both for help
Top Bottom