Crash on test device

I’m new to Corona and still getting to grips with it.  

Can anyone offer any assistance?  I have enabled corona ads and added the relevant code and updated the build.settings to display a banner ad.  But when I run on my Android device it crashes with the following errors.  

Any ideas? thanks.

Corona Class.forName: plugin.coronaAds.LuaLoaderLoading via reflection: plugin.coronaAds.LuaLoader System.err at com.coronalabs.coronaads.DeviceInfo$DeviceInfoTask.doInBackground(DeviceInfo.java:151) at com.coronalabs.coronaads.DeviceInfo$DeviceInfoTask.doInBackground(DeviceInfo.java:123) DeviceInfo New:device\_manufacturer=LGE;open\_udid=bf06dfa4aae969ad;app\_name=100 Platforms;app\_bundle\_id=com.nellyfish.hundredplatforms;app\_version=1.0.0;device\_resolution=768x1184;product\_identifier=perk\_aphone\_tv;sdk\_version=1.3;device\_model=Nexus 4;os\_version=5.1.1;corona\_ads\_version=1.3;lat=51.5164643;long=0.4343806;android\_id=bf06dfa4aae969ad;os\_name=Android AndroidRuntime at com.coronalabs.coronaads.WaterFallConfig.getAfterWaterFallSDKString(WaterFallConfig.java:137) at com.coronalabs.coronaads.CoronaAds.fireAdEventResponseForRequest(CoronaAds.java:360) at com.coronalabs.coronaads.CoronaAds.showAd(CoronaAds.java:348) at plugin.coronaAds.LuaLoader$1.run(LuaLoader.java:195) at com.coronalabs.coronaads.WaterFallConfig.getAfterWaterFallSDKString(WaterFallConfig.java:137) at com.coronalabs.coronaads.CoronaAds.fireAdEventResponseForRequest(CoronaAds.java:360) at com.coronalabs.coronaads.CoronaAds.showAd(CoronaAds.java:348) at plugin.coronaAds.LuaLoader$1.run(LuaLoader.java:195)

Is there more to the error? It would be in the device’s console log. If you’re letting Corona SDK install the app to your device for you then the messages would be in the Corona console log (assuming you didn’t dismiss the dialog box that says to leave it up until you’re done with the device console log) or you can use “adb logcat” with no extra parameters. See:

http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

I have the same problem. I started using the ADS and APP has stopped working on the test device. Can anyone help?

File: Build.settings settings = { plugins = { ["CoronaProvider.gameNetwork.google"] = {publisherId = "com.coronalabs"}, ["plugin.google.play.services"] = {publisherId = "com.coronalabs"}, }, orientation = { default ="portrait", supported = { "portraitUpsideDown", "portrait" }, }, android = { googlePlayGamesAppId = "XXXXXXXXXXXX", usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE", }, }, } File Code: ads = require("ads") local function adListener( event ) local msg = event.response print( "Message from the ads library: ", msg ) if ( event.isError ) then print( "Error, no ad received", msg ) else print( "Ah ha! Got one!" ) end return true end adProvider = "admob" bannerAppID = "ca-app-pub-XXXX...." ads.init( adProvider, bannerAppID, adListener ) Error:

--------- beginning of crash

E/AndroidRuntime(16854): FATAL EXCEPTION: main

E/AndroidRuntime(16854): Process: com.gmail.joever.hoffman.Jogo_da_Memoria, PID: 16854

E/AndroidRuntime(16854): java.lang.IllegalStateException: The meta-data tag in your app’s AndroidManifest.xml does not have the right value.  Expected 4242000 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name=“com.google.android.gms.version” android:value="@integer/google_play_services_version" />

E/AndroidRuntime(16854): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.internal.u.a(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.internal.ah.j(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.internal.ah.a(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.ads.InterstitialAd.loadAd(Unknown Source)

E/AndroidRuntime(16854): at CoronaProvider.ads.admob.AdMobAd$3.run(AdMobAd.java:209)

E/AndroidRuntime(16854): at android.os.Handler.handleCallback(Handler.java:739)

E/AndroidRuntime(16854): at android.os.Handler.dispatchMessage(Handler.java:95)

E/AndroidRuntime(16854): at android.os.Looper.loop(Looper.java:135)

E/AndroidRuntime(16854): at android.app.ActivityThread.main(ActivityThread.java:5349)

E/AndroidRuntime(16854): at java.lang.reflect.Method.invoke(Native Method)

E/AndroidRuntime(16854): at java.lang.reflect.Method.invoke(Method.java:372)

E/AndroidRuntime(16854): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)

E/AndroidRuntime(16854): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

W/ActivityManager(  998):   Force finishing activity com.gmail.joever.hoffman.Jogo_da_Memoria/com.ansca.corona.CoronaActivity

Can you try it again? We fixed something a couple of hours ago that was causing similar messages.

Rob

Thanks for getting back.  I’m afraid it’s still crashing for me. Compiled on windows with Simulator v2016.2906 (2016.6.21).  More detailed error below

FATAL EXCEPTION: main Process: com.nellyfish.hundredplatforms, PID: 8440 java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.coronalabs.coronaads.WaterFallConfig.getAfterWaterFallSDKString(WaterFallConfig.java:137) at com.coronalabs.coronaads.CoronaAds.fireAdEventResponseForRequest(CoronaAds.java:360) at com.coronalabs.coronaads.CoronaAds.showAd(CoronaAds.java:348) at plugin.coronaAds.LuaLoader$1.run(LuaLoader.java:195) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5254) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

build.settings is this

settings = { plugins = { ["plugin.coronaAds"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, android=true } }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, ["shared.android.support.v4"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true } }, }, orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", } }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", } }, -- -- iOS Section -- iphone = { iCloud = true, plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-167.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, UIPrerenderedIcon = true, UILaunchStoryboardName = 'launchscreen', UIBackgroundModes = {'remote-notification'}, UIApplicationExitsOnSuspend = false, --Requred for Corona ads NSAppTransportSecurity = { NSAllowsArbitraryLoads=true }, NSLocationAlwaysUsageDescription = { "" }, NSLocationWhenInUseUsageDescription = { "" }, } }, -- -- Android Section -- android = { installLocation = 'auto', usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_COARSE\_LOCATION", "android.permission.ACCESS\_FINE\_LOCATION", "android.permission.ACCESS\_NETWORK\_STATE", "com.google.android.providers.gsf.permissions.READ\_GSERVICES" }, applicationChildElements = { [[\<activity android:name="com.facebook.ads.InterstitialAdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/\>]] }, isGame = true, largeHeap = true }, }

Code is copied from the integration guide, just updated the guid.

I’m running this on windows pc with Android.  Bed now :)  i’ll try my mac tomorrow with an iphone.

Thanks again

Allan

My problem was solved. Thank you!

I’m also experiencing the issue allankstevens described. 

I get the exception when I try to call the show() function.

I’m still struggling with this.  I have switched from my windows to mac, and get the following error when I try and open via the simulator. 

Aug 04 03:44:02.017 [iOS Simulator] ERROR: Runtime error

Aug 04 03:44:02.017 [iOS Simulator] module ‘plugin.coronaAds’ not found:resource (plugin.coronaAds.lu) does not exist in archive
[iOS Simulator] no field package.preload[‘plugin.coronaAds’]
[iOS Simulator] no file ‘/Users/allanstevens/Library/Developer/CoreSimulator/Devices/F5AE1C07-23BE-4F3E-9376-D28F80B8003C/data/Containers/Bundle/Application/400627A0-3D56-419D-8A9A-1B34C2FAA40F/100 Platforms.app/plugin/coronaAds.lua’

Aug 04 03:44:02.059 [iOS Simulator] no file ‘/Users/allanstevens/Library/Developer/CoreSimulator/Devices/F5AE1C07-23BE-4F3E-9376-D28F80B8003C/data/Containers/Bundle/Application/400627A0-3D56-419D-8A9A-1B34C2FAA40F/100 Platforms.app/plugin/coronaAds.lua’
[iOS Simulator] no file ‘./plugin/coronaAds.so’
[iOS Simulator] no file ‘/Users/allanstevens/Library/Developer/CoreSimulator/Devices/F5AE1C07-23BE-4F3E-9376-D28F80B8003C/data/Containers/Bundle/Application/400627A0-3D56-419D-8A9A-1B34C2FAA40F/100 Platforms.app/plugin/coronaAds.so’
[iOS Simulator] no file ‘./plugin.so’
[iOS Simulator] no file '/Users/allanstevens/Library/Developer/CoreSimulator/Devices/F5AE1C07-23BE-4F3E-9376-D28F80B8003C/data/Containers/Bundle/Application/400627A0-3D56-419D-8A9A-1B34C2FAA40F/100 Platforms.app/plugin.so’plugin.coronaAds

This is the first time of have used Corona SDK on the mac and I can’t seem to get it to install on my physical device.  I get the ‘App Installation Complete’ prompt, but it’s nowhere to be seen on my device, anyway I assume this is not related.  

Thanks,

Allan

@allenkstevens: Where did this code come from?

applicationChildElements = { [[\<activity android:name="com.facebook.ads.InterstitialAdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/\>]] },

@stanga can you post your build.settings please and the version of Corona SDK you’re using?

Thanks

Rob

For both of you, can you download and build the Corona Ads sample app?
 

https://github.com/coronalabs/plugins-sample-coronaAds

Of course change any Api Keys and placement ID’s with ones in your portal. Let me know the results.

Thanks

Rob

It’s not crashing anymore, however, it’s simply not showing an ad. 

After calling the show() function, I see the callback:

{

   “name”:“adsRequest”,

   “phase”:“request”,

   “placementId”:“exhibition-interstitial”,

   “provider”:“coronaAds”,

   “isError”:false

}

And that’s all. It’s possibly a fill issue.

This brings up the following questions:

  1. how do you set a test user/test mode so I get test ads (so I don’t need to depend on a fill)

  2. How do I know if an ad is loaded?

  3. How do I load an ad without calling the show() function?

The whole flow is not clear to me. 

Normally, there is a load() function and an isLoaded() function. 

In my code I alternate different providers by checking their isLoaded() function, and I use the first provider that has an ad available.

With CoronaAds, I don’t know if there is an ad available and how to load ahead of time.

CoronaAds was designed to be simple. I don’t see any way to do real ads vs. test ads. It does not support pre-loading.  Simply call coronaAds.show() when you want to show an ad.

I don’t know if preloading is on the roadmap or not. I’ll make some inquiries.

Rob

Hi Rob, really appreciate you looking into this.

Oops, that was me ‘speed’ reading the docs  :unsure: I had copied the Note section at the bottom of this page https://docs.coronalabs.com/daily/plugin/coronaads/index.html.  I had not read that it would be automatically added.  I have now removed this and i’m still getting the index out of bounds exception.

I have also downloaded the plugins-sample-coronaAds and built it with my api key.  But i’m afraid it’s still crashing when I click the ‘Show Interstitial Ad’ button.  I have tried this on a Nexus 4 and Amazon Fire.  Error below.

08-04 21:28:52.877: E/AndroidRuntime(21617): FATAL EXCEPTION: main 08-04 21:28:52.877: E/AndroidRuntime(21617): Process: com.gmail.allankstevens.plugins\_sample\_coronaAds, PID: 21617 08-04 21:28:52.877: E/AndroidRuntime(21617): java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 08-04 21:28:52.877: E/AndroidRuntime(21617): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) 08-04 21:28:52.877: E/AndroidRuntime(21617): at java.util.ArrayList.get(ArrayList.java:308) 08-04 21:28:52.877: E/AndroidRuntime(21617): at com.coronalabs.coronaads.WaterFallConfig.getAfterWaterFallSDKString(WaterFallConfig.java:137) 08-04 21:28:52.877: E/AndroidRuntime(21617): at com.coronalabs.coronaads.CoronaAds.fireAdEventResponseForRequest(CoronaAds.java:360) 08-04 21:28:52.877: E/AndroidRuntime(21617): at com.coronalabs.coronaads.CoronaAds.showAd(CoronaAds.java:348) 08-04 21:28:52.877: E/AndroidRuntime(21617): at plugin.coronaAds.LuaLoader$1.run(LuaLoader.java:195) 08-04 21:28:52.877: E/AndroidRuntime(21617): at android.os.Handler.handleCallback(Handler.java:739) 08-04 21:28:52.877: E/AndroidRuntime(21617): at android.os.Handler.dispatchMessage(Handler.java:95) 08-04 21:28:52.877: E/AndroidRuntime(21617): at android.os.Looper.loop(Looper.java:135) 08-04 21:28:52.877: E/AndroidRuntime(21617): at android.app.ActivityThread.main(ActivityThread.java:5254) 08-04 21:28:52.877: E/AndroidRuntime(21617): at java.lang.reflect.Method.invoke(Native Method) 08-04 21:28:52.877: E/AndroidRuntime(21617): at java.lang.reflect.Method.invoke(Method.java:372) 08-04 21:28:52.877: E/AndroidRuntime(21617): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 08-04 21:28:52.877: E/AndroidRuntime(21617): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 08-04 21:28:52.878: W/ActivityManager(552): Force finishing activity 1 com.gmail.allankstevens.plugins\_sample\_coronaAds/com.ansca.corona.CoronaActivity

Could it be related to whats in my dash board as my app is showing as ‘pending’  also the settings ask for a Google Play and AppStore  details, but the app is not live yet.  

Thanks

Allan

Made some progress.  

If I use the default key (5223c2c3-cf81-4c43-ae41-2d4ed16552bc) found in the sample app, it works fine.  

But my key generates the IndexOutOfBoundsException.  Is there something I need to do to activate my key?  I have the default placement id’s and the Status is ‘pending’.  Am i missing something?

Thanks,

Allan

This sounds like a problem with your account. Please email ads AT coronalabs.com and provide them this information and see if they can look into your account and see what’s happening.

Rob

Hello all,

The bug causing the crash with java.lang.IndexOutOfBoundsException is now fixed. Rebuilding the app on Simulator should get things back to normal. No dashboard or code changes would be necessary.

Vamsee

Thanks Vamsee, it’s working for me now  :slight_smile:

Is there more to the error? It would be in the device’s console log. If you’re letting Corona SDK install the app to your device for you then the messages would be in the Corona console log (assuming you didn’t dismiss the dialog box that says to leave it up until you’re done with the device console log) or you can use “adb logcat” with no extra parameters. See:

http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

I have the same problem. I started using the ADS and APP has stopped working on the test device. Can anyone help?

File: Build.settings settings = { plugins = { ["CoronaProvider.gameNetwork.google"] = {publisherId = "com.coronalabs"}, ["plugin.google.play.services"] = {publisherId = "com.coronalabs"}, }, orientation = { default ="portrait", supported = { "portraitUpsideDown", "portrait" }, }, android = { googlePlayGamesAppId = "XXXXXXXXXXXX", usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.READ\_PHONE\_STATE", }, }, } File Code: ads = require("ads") local function adListener( event ) local msg = event.response print( "Message from the ads library: ", msg ) if ( event.isError ) then print( "Error, no ad received", msg ) else print( "Ah ha! Got one!" ) end return true end adProvider = "admob" bannerAppID = "ca-app-pub-XXXX...." ads.init( adProvider, bannerAppID, adListener ) Error:

--------- beginning of crash

E/AndroidRuntime(16854): FATAL EXCEPTION: main

E/AndroidRuntime(16854): Process: com.gmail.joever.hoffman.Jogo_da_Memoria, PID: 16854

E/AndroidRuntime(16854): java.lang.IllegalStateException: The meta-data tag in your app’s AndroidManifest.xml does not have the right value.  Expected 4242000 but found 0.  You must have the following declaration within the <application> element:     <meta-data android:name=“com.google.android.gms.version” android:value="@integer/google_play_services_version" />

E/AndroidRuntime(16854): at com.google.android.gms.common.GooglePlayServicesUtil.n(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.common.GooglePlayServicesUtil.isGooglePlayServicesAvailable(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.internal.u.a(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.internal.ah.j(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.internal.ah.a(Unknown Source)

E/AndroidRuntime(16854): at com.google.android.gms.ads.InterstitialAd.loadAd(Unknown Source)

E/AndroidRuntime(16854): at CoronaProvider.ads.admob.AdMobAd$3.run(AdMobAd.java:209)

E/AndroidRuntime(16854): at android.os.Handler.handleCallback(Handler.java:739)

E/AndroidRuntime(16854): at android.os.Handler.dispatchMessage(Handler.java:95)

E/AndroidRuntime(16854): at android.os.Looper.loop(Looper.java:135)

E/AndroidRuntime(16854): at android.app.ActivityThread.main(ActivityThread.java:5349)

E/AndroidRuntime(16854): at java.lang.reflect.Method.invoke(Native Method)

E/AndroidRuntime(16854): at java.lang.reflect.Method.invoke(Method.java:372)

E/AndroidRuntime(16854): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)

E/AndroidRuntime(16854): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)

W/ActivityManager(  998):   Force finishing activity com.gmail.joever.hoffman.Jogo_da_Memoria/com.ansca.corona.CoronaActivity

Can you try it again? We fixed something a couple of hours ago that was causing similar messages.

Rob