Home Features Docs Blog Support GitHub

Admob integration for iOS


(Fran Marzoa) #1

Hey there,

I could use some help here to integrate Admob for the iOS version of my game. I have no flipping idea of iOS native programming. My libGDX game was written with Android in mind, nonetheless I have successfully build it for iOS with MOE. Everything is working. Well, everything except Admob that’s my main income source so I really need to set it up.

I have seen some posts here about this matter, but none that have helped me. There’s one code example someone published, but it won’t even build because there’s a call to a constructor with different parameters than the constructor declaration itself, so I don’t think is too reliable.

I think it someone could just give me a comprehensive list of steps I should follow and/or concrete things that I must research, I could do my own way from there.

Thanks a lot in advance,


(Andrea Paci) #2
  1. Download the Google Ads framework with pod
  2. copy the “framework” folder inside ios-moe module
  3. make the binding (use the one provided by the MOE team, but in the first field, that should be something like “main/java/org/…”, remove the first two folder, so it becomes something like “/org/moe/…”)
  4. download some of the sample project found on the internet and copy the code

(Fran Marzoa) #3

Hey Andrea!

Thanks a million for your prompt answer.

  1. I’m using Gradle, could I just add it as a dependency for iOS as I did with the android module?
  2. Ok
  3. I don’t know how to make the binding, but I’ll research it.
  4. I downloaded one sample project published here already, but it does not even build. :frowning:
    AdMob and LibGDX Demo Project

I’m gonna start with the first two steps.

Again, thanks a lot.


(Fran Marzoa) #4

Ok, I see, I need the cocoapods, but I don’t seem to find a pod file in my project, so I’m going to make it with the zip file downloaded by hand instead.


(Andrea Paci) #5

Ok, wait
Sorry but when i answered you I was with my phone, so i couldn’t be very accurate
Since you prefer the direct download of the framework, i’ll give you a more detailed version of the steps:

  1. Download the GoogleAds Framework from the internet (be sure to download the iOS version)
  2. Inside your ios-moe module, create a folder named “framework”, and then add the googleads.framework file inside of it
  3. Now it’s time to generate the binding. If you search on google, moe stuff released on Github a series of “binding.nbc” files, one for each of the most used third party framework (and in fact, there’s one also for Google Ads). Download the relative binding.nbc of the Google framework, copy it inside the ios-moe module, and double click on it (if you are on IDEA, it should open a .nbc editor). Everything on that file is good, but remeber to change the source folder of the framework and change the “output” to just “src”. And lastly, click on the steam -> Generate Binding
  4. If no error relative to Google Ads is show, all should be good, and now you can start writing the code, inside the IOSLauncher, to initialize your Ads
  5. Last thing: remember to add the googleAds framework in the build phases inside the xcode project, together with the other frameworks needed (to see all the frameworks, simply open the project i’m linking you below)

https://drive.google.com/file/d/0BxaA-mVsTwv5SHZTR0dTNzZKQms/view?usp=sharing

P.S. : To see how to implement ads, you can easily understand how following the official google ads guide for iOS, and remember to update moe plugin to 1.4.4 (inside build.gradle)

I shouldn’t have forgotten anything, but if u get any error, just show me


(Fran Marzoa) #6

Oh thank you very much, Andrea. You’re really kind!


(Fran Marzoa) #7

Where’s that “Generate Bind” I must click on at the end of step three?

This is where I’m right now:

Thanks in advance!


(Andrea Paci) #8

Below “Keep generated Natjgen files” (above the + and the - ;near the “GoogleMobileAds” text) there’s a “steam wheel”, if you click on it, the “generate binding” option pops up


(Fran Marzoa) #9

Oh! I see now… thanks for the clarification! I shouldn’t code without wearing my glasses… :wink:

Nonetheless, it says “failed to locate platform SDK (iOS)”.

I’ve double checked that the framework files are there. I have even selected them directly with the three dots button, so they are there, that’s for sure. :confused:

EDIT: I solved this particular issue thanks to the last message in this post:


(Fran Marzoa) #10

Now I’m getting this same error twice during binding generation:

There’s a guy in that thread that seems to have it working just ignoring these. I’ll give it a try and see what happens.


(Fran Marzoa) #11

I’m getting the following errors when trying to run it in the emulator, but I think it’s proguard related:

/Users/rolandvigh/public-repo/moe/natj/natj/src/main/native/natj/ObjCRuntime.mm:1478 WARNING: Binding class refers to class GADBannerView, but it can not be found. Fallback to indirect super class.
/Users/rolandvigh/public-repo/moe/natj/natj/src/main/native/natj/NatJ.cpp:1650 FAILURE: C variable not found for method kGADAdSizeFullBanner in class org.moe.binding.googlemobileads.c.GoogleMobileAds!

I’ll update this as soon as I have solved it.


(Fran Marzoa) #12

I copied the contents from the proguard.append.cfg file of the example into my proguard.append.cfg but it made no difference at all. I’m gonna call it a night, let’s see if tomorrow I get this finally working.


(Fran Marzoa) #13

I can’t get over that error. Is there anyway to examine the oat file or something like that to make sure that it’s including everything it needs?

Any other idea to debug this problem would be more than welcome.

Thanks a million!


(Fran Marzoa) #14

Tried adding -ObjC to the linker parameters, then I got this different problem, that I don’t know if it’s an improvement or the opposite…

Undefined symbols for architecture x86_64:
“_inflate”, referenced from:
_GADNInflatedDataFromBytes in GoogleMobileAds(GADNDataCompression.o)
“_inflateEnd”, referenced from:
_GADNInflatedDataFromBytes in GoogleMobileAds(GADNDataCompression.o)
inflateInit2”, referenced from:
_GADNInflatedDataFromBytes in GoogleMobileAds(GADNDataCompression.o)
“_sqlite3_bind_text”, referenced from:
l059 in GoogleMobileAds(GADNSettings.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_close”, referenced from:
l004 in GoogleMobileAds(GADNSettings.o)
l006 in GoogleMobileAds(GADNSettings.o)
l004 in GoogleMobileAds(GADNSQLStorage.o)
l006 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_column_text”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_errmsg”, referenced from:
l059 in GoogleMobileAds(GADNSettings.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_exec”, referenced from:
l006 in GoogleMobileAds(GADNSettings.o)
l006 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_finalize”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l059 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_open”, referenced from:
l006 in GoogleMobileAds(GADNSettings.o)
l006 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_prepare_v2”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l059 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
“_sqlite3_step”, referenced from:
l005 in GoogleMobileAds(GADNSettings.o)
l059 in GoogleMobileAds(GADNSettings.o)
l005 in GoogleMobileAds(GADNSQLStorage.o)
l026 in GoogleMobileAds(GADNSQLStorage.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Honestly, this is quite frustrating. I’m gonna give MobiDevelop a chance. I think it cannot be worse.


(Andrea Paci) #15

I can’t really help you with that, using Pods doesn’t give this error, idk why u get it
I don’t recommend using mobidevelop since it’s abbandoned
But yeah, might worth giving it a try


(Fran Marzoa) #16

I may give a try with the pods then. Anyway, Mobidevelop is NOT abandoned as far as I know, in fact it’s been updated less than a month ago:

It is a fork of RoboVM, which is the one that was abandoned.


(Andrea Paci) #17

I didn’t know
Good luck and let me know, please :slight_smile: