Very basic admob question

I am trying to insert ads into my (not yet published) app. All I am doing right now is printing the result of the ads.show to a label named “rsltAd” that is in the position I would like my ad to show up.

When I run the app on my test iPhone6, I get a runtime error that says "Could not load provider (admob) : module “CoronaProvider.ads.admob” not found (and a lot of other error details).

I am thinking maybe my “appId” variable should be the actual “name” of the app, not the Publisher ID that I got from admob when I created my admob account? But this also results in a very similar error message.

During initialization, I execute the following:

local ads = require (“ads”)

local adCount = 0

local appId = “pub-415hugenumber787” – which is really a 16-digit number that is my admob “Publisher ID”

function adListener( event )

if (event.isError) then

rsltAd.text = “AD ERROR”

else

adCount = adCount + 1

rsltAd.text = "AD LOADED " … adCount

end

end

rsltAd = buildLabel ("-", X_LEFT, Y_ADBANNER)

ads.init (“admob”, appId, adListener)

ads.show (“banner”)

Your appId should look like this:

local appId = "ca-app-pub-1234567801920101/4358275647

Also, I believe interstitial and banner ads will each have their own appID, so you will need to initialize them separately if you do have both.

Where does the app ID come from?

Through the admob website, under “Monetize”, you should be creating “new ad unit”. This will give you an “ad unit Id”. That’s your appId. 

OK, did the Monetize step and got an appID that conforms to the pattern you showed. However, still get pretty much same result.

Runtime error ERROR: could not load provider (admob) due to: module ‘CoronaProvider.ads.admob’ not found resource (CoronaProvider.ads.admob.lu) does not exist in archive no field package.preload[‘CoronaProvider.ads.admob’] no file ‘/private/var/mobile/Containers/bundle/Application/and so forth and so on’

Bob, 

In your build.settings file do you have this:

settings = { plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs" }, }, }

It is required to run admob plugin. Based on the error you posted, seems likely the likely problem.

Well, I thought I did, but I had put the plugin code into the wrong build.settings file (i.e., for a different app in a different folder). By the way, this is something that bugs the heck out of me about Sublime Text 2 – I have had this happen more than once.)

The main thing is: now that I have the build.settings straightened out, I get this:

Feb 25 05:25:52.065: ERROR: Builder failed: Undefined symbols for architecture armv7:

Feb 25 05:25:52.065: BUILD ERROR: There was a problem linking the app.

 

Check the console for more information.

Feb 25 05:25:52.065:   “_OBJC_CLASS_$_ASIdentifierManager”, referenced from:

Feb 25 05:25:52.065:       objc-class-ref in libads-admob.a(GADDevice.o)

Feb 25 05:25:52.065:       objc-class-ref in libads-admob.a(GADGestureIdUtil.o)

Feb 25 05:25:52.065: ld: symbol(s) not found for architecture armv7

Feb 25 05:25:52.065: clang: error: linker command failed with exit code 1 (use -v to see invocation)

Feb 25 05:25:52.069: iOS build failed (5)

Found it!

Instead of 

plugins = { [“CoronaProvider.ads.admob”] = { publisherId = “com.coronalabs” }, }

it should be 

plugins = { [“plugin.google.play.services”] = { publisherId = “com.coronalabs” }, }

Found this in http://coronalabs.com/blog/2014/07/15/tutorial-implementing-admob-v2/

Your appId should look like this:

local appId = "ca-app-pub-1234567801920101/4358275647

Also, I believe interstitial and banner ads will each have their own appID, so you will need to initialize them separately if you do have both.

Where does the app ID come from?

Through the admob website, under “Monetize”, you should be creating “new ad unit”. This will give you an “ad unit Id”. That’s your appId. 

OK, did the Monetize step and got an appID that conforms to the pattern you showed. However, still get pretty much same result.

Runtime error ERROR: could not load provider (admob) due to: module ‘CoronaProvider.ads.admob’ not found resource (CoronaProvider.ads.admob.lu) does not exist in archive no field package.preload[‘CoronaProvider.ads.admob’] no file ‘/private/var/mobile/Containers/bundle/Application/and so forth and so on’

Bob, 

In your build.settings file do you have this:

settings = { plugins = { ["CoronaProvider.ads.admob"] = { publisherId = "com.coronalabs" }, }, }

It is required to run admob plugin. Based on the error you posted, seems likely the likely problem.

Well, I thought I did, but I had put the plugin code into the wrong build.settings file (i.e., for a different app in a different folder). By the way, this is something that bugs the heck out of me about Sublime Text 2 – I have had this happen more than once.)

The main thing is: now that I have the build.settings straightened out, I get this:

Feb 25 05:25:52.065: ERROR: Builder failed: Undefined symbols for architecture armv7:

Feb 25 05:25:52.065: BUILD ERROR: There was a problem linking the app.

 

Check the console for more information.

Feb 25 05:25:52.065:   “_OBJC_CLASS_$_ASIdentifierManager”, referenced from:

Feb 25 05:25:52.065:       objc-class-ref in libads-admob.a(GADDevice.o)

Feb 25 05:25:52.065:       objc-class-ref in libads-admob.a(GADGestureIdUtil.o)

Feb 25 05:25:52.065: ld: symbol(s) not found for architecture armv7

Feb 25 05:25:52.065: clang: error: linker command failed with exit code 1 (use -v to see invocation)

Feb 25 05:25:52.069: iOS build failed (5)

Found it!

Instead of 

plugins = { [“CoronaProvider.ads.admob”] = { publisherId = “com.coronalabs” }, }

it should be 

plugins = { [“plugin.google.play.services”] = { publisherId = “com.coronalabs” }, }

Found this in http://coronalabs.com/blog/2014/07/15/tutorial-implementing-admob-v2/