File: module 'plugin_google_play_services' not found on Corona Simulator when using Admob V2 Plugin

Hello.

If I add  

[“plugin.google.play.services”] =

        {

            publisherId = “com.coronalabs”

        }

to my builds.settings file, corona simulator won’t run.

I’m getting the following error:

File: module ‘plugin_google_play_services’ not found

Module ‘plugin_google_play_services’ not found:resource (plugin_google_play_services.lu) does not exist in archive

no field package.preload[‘plugin_google_play_services’]…

This documentation page: http://docs.coronalabs.com/plugin/ads-admob-v2/ says to require the ads library like that

local ads = require( “plugin.google.play.services” ) but http://coronalabs.com/blog/2014/07/15/tutorial-implementing-admob-v2/ says to use require(“ads”);

What is the correct? Using ** require(“ads”); it works.**

Any way to fix that?

Your build.settings file should have:

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

Your lua files where you will be using ads should have:

local ads = require( "ads" )

That’s the correct way.

Hello! I am having a similar issue. I’ve replaced 

[lua]

local ads = require(“plugin.google.play.services”);

[/lua]

with

[lua]

local ads = require(“ads”)

[/lua]

…but now when running on a device, I get this on the line I call ads.init:

attempt to call field 'init' (a nil value)

My init looks like:

[lua]

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

[/lua]

If I use

[lua]

local ads = require( “plugin.google.play.services” )

[/lua]

then it works perfectly on Android, but on iOS I get an error like this:

Runtime error module 'plugin.google.play.services' not found:resource(plugin.google.play.services.lu) does not exist in archive no field

Soooooooo what do we do? This is using build 2014.2511.

To reply directly to the original poster, since my code is working in Android (but not iOS for some reason), this should help you for your Android project:

[lua]

local sysEnv = system.getInfo(“environment”);

local ads = “”;

if(sysEnv ~= “simulator”) then

  ads = require(“plugin.google.play.services”);

end

[/lua]

I have to put in a similar Simulator check everywhere I call ads - so the Simulator won’t try to run/display them.

I think there is an error on the documentation.

On this page that explains about admob v2, it says to use require “ads”

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

But here: http://docs.coronalabs.com/plugin/ads-admob-v2/index.html it says to use  local ads = require( “plugin.google.play.services” )

So, its confusing. Someone from the staff should clarify this for us.

We are trying to get clarification on this point, but I just tested it and for now, for AdMob its:

local ads = require(“ads”)

This may change…

Rob

thanks Rob

Hi @scrapee.net,

This was a mistake on our part with the documentation. It should be require()d as Rob indicates ( (“ads”) ). I’ve updated the docs on this.

http://docs.coronalabs.com/plugin/ads-admob-v2/index.html

Brent

Your build.settings file should have:

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

Your lua files where you will be using ads should have:

local ads = require( "ads" )

That’s the correct way.

Hello! I am having a similar issue. I’ve replaced 

[lua]

local ads = require(“plugin.google.play.services”);

[/lua]

with

[lua]

local ads = require(“ads”)

[/lua]

…but now when running on a device, I get this on the line I call ads.init:

attempt to call field 'init' (a nil value)

My init looks like:

[lua]

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

[/lua]

If I use

[lua]

local ads = require( “plugin.google.play.services” )

[/lua]

then it works perfectly on Android, but on iOS I get an error like this:

Runtime error module 'plugin.google.play.services' not found:resource(plugin.google.play.services.lu) does not exist in archive no field

Soooooooo what do we do? This is using build 2014.2511.

To reply directly to the original poster, since my code is working in Android (but not iOS for some reason), this should help you for your Android project:

[lua]

local sysEnv = system.getInfo(“environment”);

local ads = “”;

if(sysEnv ~= “simulator”) then

  ads = require(“plugin.google.play.services”);

end

[/lua]

I have to put in a similar Simulator check everywhere I call ads - so the Simulator won’t try to run/display them.

I think there is an error on the documentation.

On this page that explains about admob v2, it says to use require “ads”

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

But here: http://docs.coronalabs.com/plugin/ads-admob-v2/index.html it says to use  local ads = require( “plugin.google.play.services” )

So, its confusing. Someone from the staff should clarify this for us.

We are trying to get clarification on this point, but I just tested it and for now, for AdMob its:

local ads = require(“ads”)

This may change…

Rob

thanks Rob

Hi @scrapee.net,

This was a mistake on our part with the documentation. It should be require()d as Rob indicates ( (“ads”) ). I’ve updated the docs on this.

http://docs.coronalabs.com/plugin/ads-admob-v2/index.html

Brent