ERROR: Could not load provider (admob)

Hi,

I’m experiencing issue with admob in target. For the some reason I’m getting following exception when APK is calling ads.init first time:

I/Corona  (19885): Called ads.init(admob, ca-app-pub-xxxyyy, adListener)

V/Corona  (19885): > Class.forName: CoronaProvider.ads.admob.LuaLoader

V/Corona  (19885): WARNING: Could not load ‘LuaLoader’

W/System.err(19885): java.lang.ClassNotFoundException: CoronaProvider.ads.admob.

LuaLoader

W/System.err(19885):    at java.lang.Class.classForName(Native Method)

W/System.err(19885):    at java.lang.Class.forName(Class.java:251)

W/System.err(19885):    at java.lang.Class.forName(Class.java:216)

W/System.err(19885):    at com.ansca.corona.NativeToJavaBridge.callLoadClass(Nat

iveToJavaBridge.java:319)

W/System.err(19885):    at com.ansca.corona.JavaToNativeShim.nativeRender(Native

 Method)

W/System.err(19885):    at com.ansca.corona.JavaToNativeShim.render(JavaToNative

Shim.java:184)

W/System.err(19885):    at com.ansca.corona.Controller.updateRuntimeState(Contro

ller.java:293)

W/System.err(19885):    at com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$

CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:417)

W/System.err(19885):    at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThre

ad.guardedRun(GLSurfaceView.java:1622)

W/System.err(19885):    at com.ansca.corona.graphics.opengl.GLSurfaceView$GLThre

ad.run(GLSurfaceView.java:1377)

W/System.err(19885): Caused by: java.lang.NoClassDefFoundError: CoronaProvider/a

ds/admob/LuaLoader

W/System.err(19885):    … 10 more

W/System.err(19885): Caused by: java.lang.ClassNotFoundException: Didn’t find cl

ass “CoronaProvider.ads.admob.LuaLoader” on path: DexPathList[[zip file "/data/a

pp/com.gmail.xxxxxxxxx.yyyy.Skiing_Snowman-1.apk"],nativeLibraryDirectories=[/dat

a/app-lib/com.gmail.xxxxxxxxx.yyyy.apk_name-1, /vendor/lib, /system/lib]]

W/System.err(19885):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexCla

ssLoader.java:67)

W/System.err(19885):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)

W/System.err(19885):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)

W/System.err(19885):    … 10 more

I/Corona  (19885): Runtime error

I/Corona  (19885): ERROR: Could not load provider (admob) due to the following r

eason: module ‘CoronaProvider.ads.admob’ not found:resource (CoronaProvider.ads.

admob.lu) does not exist in archive

I/Corona  (19885):      no field package.preload[‘CoronaProvider.ads.admob’]

I/Corona  (19885):      no file ‘(null)/CoronaProvider.ads.admob.lua’

I/Corona  (19885):      no file ‘(null)/CoronaProvider.ads.admob.lua’

I/Corona  (19885):      no file '/data/app-lib/com.gmail.xxxxxxxxx.yyyy.apk_name

owman-1/libCoronaProvider.ads.admob.so’

I/Corona  (19885):      no file ‘./CoronaProvider.ads.admob.so’

I/Corona  (19885):      no file ‘(null)/CoronaProvider.ads.admob.so’

I/Corona  (19885):      no file '/data/app-lib/com.gmail.xxxxxxxxx.yyyy.apk_name

owman-1/libCoronaProvider.so’

I/Corona  (19885):      no file ‘./CoronaProvider.so’

I/Corona  (19885):      no file ‘(null)/CoronaProvider.so’.

I/Corona  (19885): stack traceback:

I/Corona  (19885):      [C]: in function ‘assert’

I/Corona  (19885):      ?: in function ‘requireProvider’

I/Corona  (19885):      ?: in function ‘setCurrentProvider’

I/Corona  (19885):      ?: in function ‘init’

I/Corona  (19885):      ?: in function <?:168>

I/Corona  (19885):      ?: in function ‘dispatchEvent’

I/Corona  (19885):      ?: in function <?:861>

I/Corona  (19885):      (tail call): ?

I/Corona  (19885):      ?: in function <?:498>

I/Corona  (19885):      ?: in function <?:221>

D/STATUSBAR-NetworkController( 1189): refreshSignalCluster: data=0 bt=false

D/STATUSBAR-IconMerger( 1189): checkOverflow(1368), More:false, Req:false Child:

My build.settings looks following kind:

– Supported values for orientation:

– portrait, portraitUpsideDown, landscapeLeft, landscapeRight

settings = {

orientation = {

default = “landscapeRight”,

supported = { “landscapeRight”, }

},

android =

    {

        usesPermissions =

        {

            “android.permission.INTERNET”,

            “android.permission.ACCESS_NETWORK_STATE”,

        },

    },

plugins =

    {

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

        {

            publisherId = “com.coronalabs”

        },

    },

}

I cannot figure out why I’m missing CoronaProvider.ads.admob.lu.

Can you post your code where you are requiring the plugin and initializing the system?

Make sure to use

[lua] and [/lua]

tags to wrap the code.

Rob

HI Rob,
 
Code looks following kind: 
 
 
[lua]local ads = require( “ads” )

– The name of the ad provider.
local provider = “admob”

– Your application ID
local appID = “ca-app-pub-nnnn…”

function scene:show( event )

local showAd

– Set up ad listener.
function adListener( event )
– event table includes:
– event.provider
– event.isError (e.g. true/false )

local msg = event.response

– just a quick debug message to check what response we got from the library
print("Message received from the ads library: ", msg)

if event.isError then
statusText:setTextColor( 255, 0, 0 )
statusText.text = “Error Loading Ad”
statusText.x = display.contentWidth * 0.5

showAd( “banner” )
else
statusText:setTextColor( 0, 255, 0 )
statusText.text = “Successfully Loaded Ad”
statusText.x = display.contentWidth * 0.5
end
end

if appID then
print ( “Called ads.init(” … provider … ", " … appID … “, adListener)” )
ads.init( provider, appID, adListener )
end


– UI

– initial variables
local sysModel = system.getInfo(“model”)
local sysEnv = system.getInfo(“environment”)

– Shows a specific type of ad
showAd = function( adType )
local adX, adY = display.screenOriginX, display.screenOriginY
statusText.text = “”
ads.show( adType, { x=adX, y=adY } )
end

– if on simulator, let user know they must build for device
if sysEnv == “simulator” then
local font, size = native.systemFontBold, 22
local warningText = display.newRetinaText( “Please build for device or Xcode simulator to test this sample.”, 0, 0, 290, 300, font, size )
warningText:setTextColor( 255 )
warningText.x, warningText.y = display.contentWidth * 0.5, display.contentHeight * 0.5
else
– start with banner ad
print ( “Called ads.show function” )
ads.show( “banner”, { x=0, y=0, appId=appID, testMode=true } )
end[/lua]

 

  • Lari

I added following line before including ads library:

[lua]local ads = require “ads”
ads.init(); ads.show() – Added this, like were done in physics example[/lua]

And I got different error when trying in it target:

W/linker  (23961): libads.so has text relocations. This is wasting memory and is

 a security risk. Please fix.

I/Corona  (23961): WARNING: The ‘ads’ library is not available on this platform.

W/EDMNativeHelper(  333): EDMNativeHelperService is published

D/STATUSBAR-NetworkController( 1189): refreshSignalCluster: data=0 bt=false

D/STATUSBAR-IconMerger( 1189): checkOverflow(1440), More:false, Req:false Child:

4

W/EDMNativeHelper(  333): EDMNativeHelperService is published

I/Corona  (23961): Called ads.show function

I/Corona  (23961): Runtime error

I/Corona  (23961): ?:0: attempt to index global ‘ads’ (a nil value)

I/Corona  (23961): stack traceback:

I/Corona  (23961):      ?: in function <?:178>

I/Corona  (23961):      ?: in function ‘dispatchEvent’

I/Corona  (23961):      ?: in function <?:861>

I/Corona  (23961):      (tail call): ?

I/Corona  (23961):      ?: in function <?:498>

I/Corona  (23961):      ?: in function <?:221>

I’m now getting impression that maybe Starter version does not actually support Admob?

Starter most certainly supports AdMob.   What version of Corona SDK are you using?

Rob

Hi Rob,

I’m using v2014.2393. How ever I got it working now. I simplified my code what was originally basis from InMob sample.

Snipped code:

[lua]local ads = require “ads”

– The name of the ad provider.
provider = “admob”

– Your application ID
appID = “ca-app-pub-nnnn…”

– Set up ad listener.
local function adListener( event )

local msg = event.response

– just a quick debug message to check what response we got from the library
print("Message received from the ads library: ", msg)

if event.isError then
print “Error Loading Ad”
else
print “Successfully Loaded Ad”

end
end

– if on simulator, let user know they must build for device
if sysEnv == “simulator” then
local font, size = native.systemFontBold, 22
local warningText = display.newRetinaText( “Please build for device or Xcode simulator to test this sample.”, 0, 0, 290, 300, font, size )
warningText:setTextColor( 255 )
warningText.x, warningText.y = display.contentWidth * 0.5, display.contentHeight * 0.5
else
print ( “Called ads.init(” … provider … ", " … appID … “, adListener)” )
ads.init( provider, appID, adListener )

– start with banner ad
print ( “Called ads.show function” )
–ads.show( “banner”, { x=0, y=0, appId=appID, testMode=true } )
ads.show( “banner”, { x=0, y=0 } )
end[/lua]

-> Problem solved, Thanks :slight_smile:

Can you post your code where you are requiring the plugin and initializing the system?

Make sure to use

[lua] and [/lua]

tags to wrap the code.

Rob

HI Rob,
 
Code looks following kind: 
 
 
[lua]local ads = require( “ads” )

– The name of the ad provider.
local provider = “admob”

– Your application ID
local appID = “ca-app-pub-nnnn…”

function scene:show( event )

local showAd

– Set up ad listener.
function adListener( event )
– event table includes:
– event.provider
– event.isError (e.g. true/false )

local msg = event.response

– just a quick debug message to check what response we got from the library
print("Message received from the ads library: ", msg)

if event.isError then
statusText:setTextColor( 255, 0, 0 )
statusText.text = “Error Loading Ad”
statusText.x = display.contentWidth * 0.5

showAd( “banner” )
else
statusText:setTextColor( 0, 255, 0 )
statusText.text = “Successfully Loaded Ad”
statusText.x = display.contentWidth * 0.5
end
end

if appID then
print ( “Called ads.init(” … provider … ", " … appID … “, adListener)” )
ads.init( provider, appID, adListener )
end


– UI

– initial variables
local sysModel = system.getInfo(“model”)
local sysEnv = system.getInfo(“environment”)

– Shows a specific type of ad
showAd = function( adType )
local adX, adY = display.screenOriginX, display.screenOriginY
statusText.text = “”
ads.show( adType, { x=adX, y=adY } )
end

– if on simulator, let user know they must build for device
if sysEnv == “simulator” then
local font, size = native.systemFontBold, 22
local warningText = display.newRetinaText( “Please build for device or Xcode simulator to test this sample.”, 0, 0, 290, 300, font, size )
warningText:setTextColor( 255 )
warningText.x, warningText.y = display.contentWidth * 0.5, display.contentHeight * 0.5
else
– start with banner ad
print ( “Called ads.show function” )
ads.show( “banner”, { x=0, y=0, appId=appID, testMode=true } )
end[/lua]

 

  • Lari

I added following line before including ads library:

[lua]local ads = require “ads”
ads.init(); ads.show() – Added this, like were done in physics example[/lua]

And I got different error when trying in it target:

W/linker  (23961): libads.so has text relocations. This is wasting memory and is

 a security risk. Please fix.

I/Corona  (23961): WARNING: The ‘ads’ library is not available on this platform.

W/EDMNativeHelper(  333): EDMNativeHelperService is published

D/STATUSBAR-NetworkController( 1189): refreshSignalCluster: data=0 bt=false

D/STATUSBAR-IconMerger( 1189): checkOverflow(1440), More:false, Req:false Child:

4

W/EDMNativeHelper(  333): EDMNativeHelperService is published

I/Corona  (23961): Called ads.show function

I/Corona  (23961): Runtime error

I/Corona  (23961): ?:0: attempt to index global ‘ads’ (a nil value)

I/Corona  (23961): stack traceback:

I/Corona  (23961):      ?: in function <?:178>

I/Corona  (23961):      ?: in function ‘dispatchEvent’

I/Corona  (23961):      ?: in function <?:861>

I/Corona  (23961):      (tail call): ?

I/Corona  (23961):      ?: in function <?:498>

I/Corona  (23961):      ?: in function <?:221>

I’m now getting impression that maybe Starter version does not actually support Admob?

Starter most certainly supports AdMob.   What version of Corona SDK are you using?

Rob

Hi Rob,

I’m using v2014.2393. How ever I got it working now. I simplified my code what was originally basis from InMob sample.

Snipped code:

[lua]local ads = require “ads”

– The name of the ad provider.
provider = “admob”

– Your application ID
appID = “ca-app-pub-nnnn…”

– Set up ad listener.
local function adListener( event )

local msg = event.response

– just a quick debug message to check what response we got from the library
print("Message received from the ads library: ", msg)

if event.isError then
print “Error Loading Ad”
else
print “Successfully Loaded Ad”

end
end

– if on simulator, let user know they must build for device
if sysEnv == “simulator” then
local font, size = native.systemFontBold, 22
local warningText = display.newRetinaText( “Please build for device or Xcode simulator to test this sample.”, 0, 0, 290, 300, font, size )
warningText:setTextColor( 255 )
warningText.x, warningText.y = display.contentWidth * 0.5, display.contentHeight * 0.5
else
print ( “Called ads.init(” … provider … ", " … appID … “, adListener)” )
ads.init( provider, appID, adListener )

– start with banner ad
print ( “Called ads.show function” )
–ads.show( “banner”, { x=0, y=0, appId=appID, testMode=true } )
ads.show( “banner”, { x=0, y=0 } )
end[/lua]

-> Problem solved, Thanks :slight_smile: