Hey guys!

I completely rewrote official extension-admob as it is like 4+ years old and looks abandoned.

New version supports iOS SDK 8.5 and Android SDK 20.0.3.
There are still some bugs, but banners/interstitials work fine for me.

If anyone wants to give it a try and share their experience, you are more than welcome.
Updated version is here:


great job, just curious if it is or can be made EU compatible ?

It is possible, but I’m not going to do at the moment, as I still need to test basic functionality and fix some bugs.

Hi @pozirk,

You’re a lifesavior, I spent most of the afternoon testing several google ads libraries for openfl and they all seemed at least 4+ years old and broken at this point. Which would make me want to avoid making Android apps using openfl.

If you don’t mind my inexperienced questions, I tried building the app but got errors in the AdMobEx dependency:

C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdMobEx.java:46: error: class AdmobEx is public, should be declared in a file named AdmobEx.java
public class AdmobEx extends Extension
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdMobEx.java:16: error: cannot find symbol
import com.google.android.gms.ads.AdError;
  symbol:   class AdError
  location: package com.google.android.gms.ads
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdMobEx.java:21: error: cannot find symbol
import com.google.android.gms.ads.FullScreenContentCallback;
  symbol:   class FullScreenContentCallback
  location: package com.google.android.gms.ads
 C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdMobEx.java:22: error: cannot find symbol
import com.google.android.gms.ads.LoadAdError;
  symbol:   class LoadAdError
  location: package com.google.android.gms.ads
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdMobEx.java:24: error: cannot find symbol
import com.google.android.gms.ads.RequestConfiguration;
  symbol:   class RequestConfiguration
  location: package com.google.android.gms.ads
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdMobEx.java:25: error: package com.google.android.gms.ads.initialization does not exist
import com.google.android.gms.ads.initialization.InitializationStatus;

I have followed your advice to use Android SDK v.30 and Gradle version 6.7.1.

Any ideas how I could fix that, as I would really like to try out your library?

Thanks in advance :slight_smile:

PS: You may need to create a new fork of the library with a new name to push it to haxelib. In particular, do mind the naming “AdMob.hx” instead of “Admob.hx” to remain consistent.

Hey agbephh!

FIrst, you need to rename AdMobEx.java to AdmobEx.java, looks like Github kept old file name.
For “symbols not found”, I guess you don’t have Google Play services installed from SDK Manager.
I’m not at my computer at the moment, will be able to check for sure only in a week.

Yeah, I kind of didn’t like “AdMob”, so renamed everything to “Admob”, but Github left it as before.
So, you should rename to “Admob.hx” too.
Let me know, how it goes. :slight_smile:


Hey @pozirk, thank you for your involvement!

I have tried with these installed:

and I still get these same errors, ending with:

C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdmobEx.java:257: error: cannot find symbol
                                InterstitialAd.load(mainActivity, id, adRequest, new InterstitialAdLoadCallback() {
  symbol: class InterstitialAdLoadCallback
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdmobEx.java:257: error: cannot find symbol
                                InterstitialAd.load(mainActivity, id, adRequest, new InterstitialAdLoadCallback() {
  symbol: variable InterstitialAd
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdmobEx.java:332: error: cannot find symbol
                                RewardedAd.load(mainActivity, id, adRequest, new RewardedAdLoadCallback() {
  symbol: class RewardedAdLoadCallback
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdmobEx.java:332: error: cannot find symbol
                                RewardedAd.load(mainActivity, id, adRequest, new RewardedAdLoadCallback() {
  symbol: variable RewardedAd
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdmobEx.java:380: error: cannot find symbol
                                        _rewarded.show(mainActivity, new OnUserEarnedRewardListener() {
  symbol: class OnUserEarnedRewardListener
C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdmobEx.java:417: error: cannot find symbol
                return AdSize.getCurrentOrientationAnchoredAdaptiveBannerAdSize(mainContext, adWidth);
  symbol:   method getCurrentOrientationAnchoredAdaptiveBannerAdSize(Context,int)
  location: class AdSize
Note: C:\Users\AgbePhH\Git\test\GameExport\android\bin\deps\admobex\src\admobex\AdmobEx.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
27 errors

FAILURE: Build failed with an exception.

I read this might need some specific changes in the build.gradle, but I don’t know how it translates in terms of OpenFL configurations.

Apologies as I understand it is not the fault of your implementation of Admob :slight_smile:

I’m not sure why you have these errors, as I never had them myself, but looks like it’s still can’t get to Google Play service APIs.
So let’s try to recreate the same environment, that I have:

  1. Download android-ndk-r21e
  2. Run openfl setup android to set correct path for android sdk and ndk
  3. Check this thread and follow the steps I took to fix problems with Lime: https://github.com/haxelime/lime/issues/1476
  4. Install extension-googleplayservices-basement and add it to your project

Try to rebuild project after each step to see what fixes the problem. I think 4th step is the solution.

1 Like

Hello :slight_smile:

Please tell me if you need me to create a new topic for the issues we’re discussing.

I’ve added the following to the project (the lib was already installed on haxelib) and it doesn’t fix the issue
<haxelib name="extension-googleplayservices-basement" />

I’m very confused about the NDK. I read it was somewhat optional when you have the SDK. I was using an older “r15c” NDK.

I tried switching to NDK-r21e following your advice, but it seems to make clang++ mandatory, which I don’t have.


Being on Windows 10, I tried the following steps:

  • Installed CMake.
  • Installed Ninja for the generator.
  • Installed Mingw for gcc and g++.
  • Tried building LLVM (for CLANG++) but encountered errors.

Do you have any source to understand why a more recent NDK is required?
Do you confirm I need to have clang++ as a compiler for it?

It seems g++ no longer builds Android.

Perhaps we need to closely follow this issue.

I’m on windows 8, there is no need to install all this, android-ndk-r21e is working fine.
Make sure to install the latest version of haxe 4.2.4, openfl, hxcpp, lime

android-ndk-r23b is not going to work with Lime!
Java can be any, I think, but I have jdk1.8.0_301.

Hi @pozirk, I’ve been trying to get your AdMob extension working but seem to be hitting problems for both Android and iOS. Any help would be appreciated. I’m on OSX 10.15 (Catalina) and using XCode 12 (tried 11.3 but got issues with the tracking transparency with iOS 14 so moved to 12).

For iOS, the build seems to go most of the way through but then fails with:

Framework not found GoogleMobileAds

Even though the GoogleMobileAds.framework is listed in the project Frameworks folder - I’m not sure how to fix this.

For Android, as I mentioned above, using XCode 11.x didn’t build due to the tracking transparency with iOS 14. With XCode 12, the build again goes to the final gradle steps then fails with references to:

Execution failed for task ':app:checkDebugAarMetadata'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckAarMetadataWorkAction
   > The minCompileSdk (31) specified in a
     dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
     is greater than this module's compileSdkVersion (android-30).
     Dependency: androidx.work:work-runtime:2.7.0.

I’m targetting Android-30 and there are several solutions on Google about forcing/adding a dependency or api reference to the work-runtime:2.6.0 - to get around the error, but none that I’ve tried seem to work, or I’m just not putting the fixes in the correct build.gradle location. I’ve also tried using Android-31 which supports the 2.7.0 version and first time it complained that Android 12 needed an ‘android:exported=“false/true”’ parameter - I added this (true and false) and the build succeeded but getting a blank screen.

Things just seem to have moved on versions since your helpful post and it’s just got a bit complicated for me.



I’m on MacOS 12 and XCode 13, not sure if it makes any difference.
There are 2 ways to add a framework and one of them not working as expected.

  1. Framework at the left tree panel
  2. General project properties - this one, as I recall, didn’t work, didn’t actually add a framework

You are not supposed to add GoogleMobileAds.framework manually, it should be added by extension, but try to remove it and re-add, make sure it’s from extension, see Path at the top right corner.

For Android, I think I had this issue myself, fix similar to this one helped:

I’m not sure why I didn’t metion it in readme, I guess, I was hoping the problem would go away eventually, cause it’s just SDK version mismatch.
You need to add it to Lime bulid.gradle though:
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
	buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
	lintOptions { //pozirk - this might help with other problems
		checkReleaseBuilds false
	defaultConfig {
		applicationId "::META_PACKAGE_NAME::"
		minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
		targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
		versionCode Integer.parseInt(project.VERSION_CODE)
		versionName project.VERSION_NAME
		::if (languages != null)::resConfigs ::foreach languages::"::__current__::", ::end::""::end::
		configurations.all { //pozirk - should fix your problem
            resolutionStrategy { force 'androidx.work:work-runtime:2.6.0' }

It might actually worked for you with SDK31, listen for extension events to see if you initialize it correctly and check adb logs, admob doesn’t show any ads except test in debug version, so blank screen is normal.

Thanks for the reply. I’m making progress - I think. Android is building using your build.gradle changes and SDK 30 but I’m getting a blank screen still. I’m only using banner ads and the test ad appears but my app content doesn’t. If I remove the extension-admob my app displays fine. So still working on that on.

I’m still having iOs build issues so may need to try xcode 13.

Will keep trying. Thanks again.


Hi @pozirk. Unfortunately I haven’t been able to get any further with these issues for both Android and iOS, and I’m runnning out of ideas. I’m using the current released versions of OpenFL(9.1.0) and Lime(7.9.0). Other versions are: Haxe=4.2.4, hxcpp=4.2.1, hxp=1.2.2, your extension-admob=2.0.1 (using the ./buildPackage.sh and .installPackage.sh and that created the zip).

Android: SDK: 30 m& NDK: 21e

  • Doing a ‘lime rebuild android -clean’ does nothing as I’m on the released version of OpenFL/Lime.
  • If I use the latest git versions of both I’m unable to build lime as I get load of errors which I think is due to NDK21 as opposed to the suggested version NDK 15c
  • I’ve added the following to the template AndroidManifest.xml node:
    tools:remove=“android:appComponentFactory” android:appComponentFactory=“whateverString” android:allowNativeHeapPointerTagging=“false”
  • These were from Googling about SDK 30 blank screen issues and appComponentFactory errors I saw in logcat.
  • I’ve also your recommendations in the lime gradle.properies of:

But I still get a blank screen with the exception of the test advert being shown (which is shows your part works). The application is still running and I can log screen touches and things work normally but with a blank display. There is a lot of stuff in the logcat but I can’t determine if there is anything specific that is reporting anything about the blank screen. If I remove your extension but keep the SDk 30 the same happens so the extension appears to be fine.

iOS: macOS 12.3.1, XCode 13.3, iOS SDK 15.4.
No matter what I seem to try, the build gets all the way through and fails with the final linking of the GoogleMobileAds framework. I’ve added the path into the search paths, removed and re-added the framwork, moved the folder to be within the project folder, changed the order of the framework search paths and probably other things as well.

The output of the clang++ command that throws the error shows that the framwork is listed and the search path is present. Running this command on it’s own fails in the same way. I’ve even tried tweaking this command manually but still no joy.

I’ve seen references to using a xcworkspace instead of the xcodeproj that OpenFL generates - but that didn’t work and I think that’s to do with using CocoaPods to add dependencies to a project. I’ve not used it before. Do you use CocoaPods at all?

Again, any help would be much appreciated.


Black screen on Android might be this:

I have the same OpenFL and Android environment as you.

I’m not sure why for iOS it can’t find GoogleMobileAds framework. Maybe something with the naming.
Try download all the frameworks again and replace them:

I managed to get Android working. Seems my AndroidManifest.xml template wasn’t merging correctly as part of the build. I’m now using SDK 31 and the test ad is working.

For iOS, which version of the Mobile Ads SDK are you using in the extension. When I use the latest 9.3.0 I get compilation errors as there are differences in the API. I’ve tried to change the AdmobEx.mm to correct the differences but I’m battling with an error in the way things are now implemented with GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth - Can’t quite figure out how to fix it yet.

Did you use work-runtime:2.7.0 with Android SDK31?

For iOS, I’m using Mobile Ads SDK 8.11, they’ve made some changes again in v9, so annoying.

Yes (I think so). I removed the resolutionStrategy and the lintOptions and have built both debug and release versions. The debug showed the test ads but the release version showed nothing but I suspect that is due to the app not being available on the store and the AdMob banner still under ‘review’.

I’ve not retried 8.11 yet but have been looking at 9.3 still for iOS. I have managed to get a clean build that ran but didn’t show the test ad. To get it to build, I removed the

self._banner = [[GADBannerView alloc] initWithAdSize:GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth(viewWidth)];


self._banner = [[GADBannerView alloc] initWithAdSize:GADAdSizeBanner];

Still can’t figure out why it complains about GADCurrentOrientationAnchoredAdaptiveBannerAdSizeWithWidth.

I also had to tweak the buildPackages and installPackages. Firstly, with the buildPackages, when building for iOS, I had a runtime failure immediately as it complained that no AdMob ID had been provided in the Info.plist. This was due to the zip file not containing the templates folder. Secondly, with the installPackages I’ve changed it to use haxelib install extension-admob.zip as haxelib local gave a warning about being deprecated.

Well, I will update extension to th latest iOS SDK eventually, but I’m not sure on timing.

Shouldn’t be problems with Admob ID, have you provided it in your project.xml?
File extension-admob-Info.plist from templates folder should be inserted in your Info.plist automatically.

No problem. I appreciate your efforts on this so far and the help you’ve given. It doesn’t help how rapidly these changes come and force updates to different things and then break others. It’s hard keeping everything up-to-date.

The AdMob ID issue was probably due to me using the buildPackages.sh and installPackages.sh method which didn’t include the templates folder in the zip - so the haxelib version didn’t contain that folder. Not a problem as I got that fixed.

I’m probably going admob free for a little while until I’ve got it all working so I can at least get some kind of release out (and verified that I can get through the process end-to-end).

I’ll probably come back to it in a week or so.

I think I will be able to update extension with the latest changes somewhere in May as I need to update my own games at AppStore.

1 Like