GameThrive working on iOS, not working on Android. attempt to call field 'Init' (a nil value)

Hello,

I am running into an odd situation. In my app, one of the first things attempted in main.lua is registration with GameThrive, so that push notifications get set up correctly. However, on Android devices, the executing code cannot even find GameThrive.init().

This functionality works for all iOS devices. I have definitely had GameThrive working in the past, bt I have focused heavily on iOS the past several months. Anyway, this functionality is failing for my Android device. When I comment out all GameThrive code, the app runs normally on the Android device.

Here is the attempted code (identifiers changed, of course):

local GameThrive = require "plugin.GameThrivePushNotifications" --line 4 of main.lua --lots of code in between GameThrive.Init("xxxxx-xxxxx-xxxxx-xxxxx-xxxxx", "xxxxx", DidReceiveRemoteNotification) --line 282 of main.lua

On my Android device, I receive the following error message:

I/Corona  (12381): Runtime error

I/Corona  (12381): C:\xxx\xxx\xxx\src\main.lua:282: attempt to call field ‘Init’ (a nil value)

I tried to attach my build.settings to this post in case that is helpful to look at, but it wouldn’t permit me to upload that kind of file. So I have pasted mine below (identifiers removed). Has anyone else seen this issue? Does anyone have any good insight on what may be causing this or how it might be resolved?

settings = { orientation = { default = landscapeRight, supported = { "landscapeLeft", "landscapeRight" }, }, iphone = { plist= { UIBackgroundModes = {"remote-notification"}, UIStatusBarHidden=true, UIApplicationExitsOnSuspend=false, UIInterfaceOrientation = "UIInterfaceOrientationLandscapeRight", UISupportedInterfaceOrientations = { "UIInterfaceOrientationLandscapeLeft","UIInterfaceOrientationLandscapeRight" }, FacebookAppID = "xxxxx", CFBundleShortVersionString = "1.0", CFBundleURLTypes = { { CFBundleURLSchemes = { "xxxxx", } } }, CFBundleIconFiles = { "Icon-60.png","Icon-60@2x.png","Icon-76.png","Icon-76@2x.png","Icon-Small-40.png","Icon-Small-40@2x.png","Icon.png","Icon@2x.png","Icon-72.png","Icon-72@2x.png","Icon-Small-50.png","Icon-Small-50@2x.png","Icon-Small.png","Icon-Small@2x.png" }, --launch image files table UILaunchImages = { { -- iPhone 4 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 5 Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad Portrait ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Portrait", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeRight ["UILaunchImageMinimumOSVersion"] = "7.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPhone 6 Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 Plus Portrait ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-736h", ["UILaunchImageOrientation"] = "Portrait", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{414, 736}" }, }, UIAppFonts = { "Erbos Draco 1st Open NBP.ttf", }, }, }, android = { permissions = { { name = ".permission.C2D\_MESSAGE", protectionLevel = "signature" }, }, usesPermissions = { "android.permission.INTERNET", "android.permission.ACCESS\_NETWORK\_STATE", "android.permission.GET\_ACCOUNTS", "android.permission.RECEIVE\_BOOT\_COMPLETED", "com.google.android.c2dm.permission.RECEIVE", ".permission.C2D\_MESSAGE", }, }, plugins = { -- key is the name passed to Lua's 'require()' ["plugin.GameThrivePushNotifications"] = { -- required publisherId = "com.gamethrive", }, ["plugin.google.play.services"] = { publisherId = "com.coronalabs", supportedPlatforms = { android=true, }, }, ["facebook"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, }, }

Thanks!

Hello,

Could you send us a full LogCat form when your app starts? There should be more lines about GameThrive before the error you posted. Could you let us know what build version of Corona your use? You can also send us your APK and we can look a look at it as well. You can send them to support@gamethrive.com.

Lastly I see you have some extra Android permission lines you don’t need to define.

These lines GameThrive already adds for you:

{ name = “.permission.C2D_MESSAGE”, protectionLevel = “signature” },

“com.google.android.c2dm.permission.RECEIVE”,

“.permission.C2D_MESSAGE”,

RECEIVE_BOOT_COMPLETED is only needed if you use Corona’s local notifications and GET_ACCOUNTS isn’t used by GameThrive so you should be able to remove that too.

Thanks.

Thanks for looking at this jkasten. Here is the full logcat from running: adb logcat Corona:v *:s

--------- beginning of /dev/log/system --------- beginning of /dev/log/main V/Corona (15113): \> Class.forName: network.LuaLoader V/Corona (15113): \< Class.forName: network.LuaLoader V/Corona (15113): Loading via reflection: network.LuaLoader I/Corona (15113): Platform: SCH-S738C / ARM Neon / 4.0.4 / Adreno (TM) 200 / Op enGL ES 2.0 2184622 / 2014.2381 V/Corona (15113): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (15113): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (15113): Loading via reflection: CoronaProvider.licensing.google.LuaLo ader I/Corona (15113): Runtime error I/Corona (15113): C:\Users\Joe\Dropbox\create\HookShots\src\main.lua:282: attem pt to call field 'Init' (a nil value) I/Corona (15113): stack traceback: I/Corona (15113): C:\Users\Joe\Dropbox\create\HookShots\src\main.lua:282: in main chunk I/Corona (15113): [Lua::RuntimeDispatchEvent()] WARNING: This function is depre cated. Use Lua::DispatchRuntimeEvent() instead. I/Corona (15113): Registering player with event.token: APA91bHOBcdGYTGQXqBPXrlz 2sbDNofMEitH0kBwN4RD7UQ37IPZqlmEcMDAbPGP25yvBI2bBmxoytDgwzfhaKLQr0GbIcBJayYNmNGh F64gXfHohUkOvjOCe9Qm07GBYq7aRfzLZv7UUrc25GONk8qUb6pwT9VU9g I/Corona (15113): GameThrive API Error I/Corona (15113): {"errors":["app\_id not found."]}

I have only posted this here for now. Let me know if you want me to email this (and the .apk) to support@gamethrive.com

Thank you.

That is odd, you are getting a nil error on GameThrive but then below I see errors about the app_id not being set in your LogCat.

What Build of Corona are you using? If your using 2014.2393 or newer you will need to follow our upgrade instructions located here. http://forums.coronalabs.com/topic/51526-important-update-gamethrive-sdk-140/

If your still getting errors after upgrading send us the new logcat and we can take a look.

Thanks.

My GameThrive issue is resolved. It was a Corona versioning issue. I had an old version of Corona (2014.2381) on my PC. I had the up-to-date version of Corona on my Mac, so when I built it, it worked correctly. But when I built from my PC for Android, I was calling GameThrive.Init() with the new Init(“APP-ID”,“googleProjectNumber”,callback) call, but Corona 2014.2381 had no concept of that function yet.

After re-building using an up-to-date version of Corona, it works just fine.

Thanks for solving that for me jkasten!

Hello,

Could you send us a full LogCat form when your app starts? There should be more lines about GameThrive before the error you posted. Could you let us know what build version of Corona your use? You can also send us your APK and we can look a look at it as well. You can send them to support@gamethrive.com.

Lastly I see you have some extra Android permission lines you don’t need to define.

These lines GameThrive already adds for you:

{ name = “.permission.C2D_MESSAGE”, protectionLevel = “signature” },

“com.google.android.c2dm.permission.RECEIVE”,

“.permission.C2D_MESSAGE”,

RECEIVE_BOOT_COMPLETED is only needed if you use Corona’s local notifications and GET_ACCOUNTS isn’t used by GameThrive so you should be able to remove that too.

Thanks.

Thanks for looking at this jkasten. Here is the full logcat from running: adb logcat Corona:v *:s

--------- beginning of /dev/log/system --------- beginning of /dev/log/main V/Corona (15113): \> Class.forName: network.LuaLoader V/Corona (15113): \< Class.forName: network.LuaLoader V/Corona (15113): Loading via reflection: network.LuaLoader I/Corona (15113): Platform: SCH-S738C / ARM Neon / 4.0.4 / Adreno (TM) 200 / Op enGL ES 2.0 2184622 / 2014.2381 V/Corona (15113): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (15113): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona (15113): Loading via reflection: CoronaProvider.licensing.google.LuaLo ader I/Corona (15113): Runtime error I/Corona (15113): C:\Users\Joe\Dropbox\create\HookShots\src\main.lua:282: attem pt to call field 'Init' (a nil value) I/Corona (15113): stack traceback: I/Corona (15113): C:\Users\Joe\Dropbox\create\HookShots\src\main.lua:282: in main chunk I/Corona (15113): [Lua::RuntimeDispatchEvent()] WARNING: This function is depre cated. Use Lua::DispatchRuntimeEvent() instead. I/Corona (15113): Registering player with event.token: APA91bHOBcdGYTGQXqBPXrlz 2sbDNofMEitH0kBwN4RD7UQ37IPZqlmEcMDAbPGP25yvBI2bBmxoytDgwzfhaKLQr0GbIcBJayYNmNGh F64gXfHohUkOvjOCe9Qm07GBYq7aRfzLZv7UUrc25GONk8qUb6pwT9VU9g I/Corona (15113): GameThrive API Error I/Corona (15113): {"errors":["app\_id not found."]}

I have only posted this here for now. Let me know if you want me to email this (and the .apk) to support@gamethrive.com

Thank you.

That is odd, you are getting a nil error on GameThrive but then below I see errors about the app_id not being set in your LogCat.

What Build of Corona are you using? If your using 2014.2393 or newer you will need to follow our upgrade instructions located here. http://forums.coronalabs.com/topic/51526-important-update-gamethrive-sdk-140/

If your still getting errors after upgrading send us the new logcat and we can take a look.

Thanks.

My GameThrive issue is resolved. It was a Corona versioning issue. I had an old version of Corona (2014.2381) on my PC. I had the up-to-date version of Corona on my Mac, so when I built it, it worked correctly. But when I built from my PC for Android, I was calling GameThrive.Init() with the new Init(“APP-ID”,“googleProjectNumber”,callback) call, but Corona 2014.2381 had no concept of that function yet.

After re-building using an up-to-date version of Corona, it works just fine.

Thanks for solving that for me jkasten!