App works on simutlator but goes black when opened on device

Title says everything. I have the latest build of corona.

I did a build for my game and put it on the app store without checking if it works (my mistake).

I test it the next day, and the corona logo shows up and then the screen goes black (on the phone).

The app works (runs normally) on the simulator but not on the phone.

What the hell is going on?

The only plugins i have is appodeal.

What do i do?

going to post the device console logs on here.

99% of the time this is a filenaming issue.

Win / OSX are not case sensitive.

iOS/Android are.

There should be warnings in the simulator log when you goof this up, but don’t rely on that.

Give us a link to your game (store link) here.

My app was working before but when i submitted my app on the google play store, it said the API level is 25 and should be 26.

I updated corona to the latest version and that fixed the problem.

But when installed the new build of the app it goes to a black screen instead. 

I can not find any of the console logs for my android device.

Here is the game link:

https://play.google.com/store/apps/details?id=com.gotinoapps.rat_hunter

Are you using  adb logcat?

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

Well I can see you didn’t leave debug symbols enabled so this is pretty useless (adb logcat log):

V/Corona ( 4081): \> Class.forName: network.LuaLoader V/Corona ( 4081): \< Class.forName: network.LuaLoader V/Corona ( 4081): Loading via reflection: network.LuaLoader I/Corona ( 4081): Platform: SM-T230NU / ARM Neon / 4.4.2 / Vivante GC1000 / OpenGL ES 2.0 / 2018.3329 / English | US | en\_US | en V/Corona ( 4081): \> Class.forName: \_Corona\_Build\_Number.LuaLoader V/Corona ( 4081): \> Class.forName: shared.google.play.services.base.LuaLoader V/Corona ( 4081): \< Class.forName: shared.google.play.services.base.LuaLoader V/Corona ( 4081): Loading via reflection: shared.google.play.services.base.LuaLoader V/Corona ( 4081): \> Class.forName: \_CoronaSetup.LuaLoader V/Corona ( 4081): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona ( 4081): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona ( 4081): Loading via reflection: CoronaProvider.licensing.google.LuaLoader I/Corona ( 4081): ERROR: Runtime error I/Corona ( 4081): ?:0: attempt to index a nil value I/Corona ( 4081): stack traceback: I/Corona ( 4081): ?: in main chunk

You’ve got some kind of syntax error in your code.

I’m available to debug this, but doing so it pretty easy so I suggest you do the following.

  1. Install ADB Logcat

  2. Turn on debug symbols in your build.

  3. Uninstall the app from your device

  4. Build and install the app onto your device.

  5. Run ADB logcat console.

  6. Run game.

The log should then show a meaningful message.

To enable debug symbols add this to build.settings:

settings = { ... build = { neverStripDebugInfo = true, }, ... }

… or you can get help: https://forums.coronalabs.com/topic/69420-hire-a-hitman-problem-solver-is-back/

If I were to warrant a guess, you are reading a saved JSON encoded table from disk and trying to access it.  

Most users goof this up by forgetting to handle the, file doesn’t exist yet case.

Just a guess.

Im trying to get adb logcat working but it doesnt work.

I can add that neverStripDebugInfo thing and send you the apk.

I have this in my main.lua file:

local composer = require "composer" local ssk = require "ssk2.loadSSK" ssk.init() local json = require("json") local loadsave = require("loadsave") local main\_variables=loadsave.loadTable( "main\_variables.json" ) if main\_variables.reset == nil then main\_variables = {} main\_variables.highscore = 0 main\_variables.score = 0 main\_variables.lastscore = 0 main\_variables.score\_start=0 main\_variables.reset=nil --main\_varriable.reset is set to 1 in game file. loadsave.saveTable( main\_variables, "main\_variables.json" ) end local appodeal = require( "plugin.appodeal" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) appodeal.show( "banner", {yAlign="top", placement="bannerPlacement"} ) appodeal.load( "rewardedVideo", {placement="rewardPlacement"} ) appodeal.load( "interstital", {placement="intPlacement"} ) end end -- Initialize the Appodeal plugin appodeal.init( adListener, { appKey="notShowing" } ) composer.gotoScene( "maker" )

Anything wrong there?

  1. I think you missed my last post.

  2. Every morning I take a look at posts and try to answer where possible.  I’m about done now and starting work.

  3. Please don’t send me your APK.  If you want to take out a hit that is fine, just follow the directions here.

  4. I’ve given you a start and I think you can solve this.  You do need to get ADB working on your machine however.  This is a basic thing that one need to know how to do.

One more thing.  Try this

  1. Open your app in the simulator.

  2. Find the sandbox documents folder.

  3. Close your app.

  4. Delete the contents in the documents folder.

  5. Restart your app.

It will probably crash and you’ll get an better error message.

@roaminggamer you were right the json code was a bit broken.

Fixed it and the app works perfectly.

By the way, if you have some free time please download the updated app and tell me what you think of it.

Thanks a bunch boss.

going to post the device console logs on here.

99% of the time this is a filenaming issue.

Win / OSX are not case sensitive.

iOS/Android are.

There should be warnings in the simulator log when you goof this up, but don’t rely on that.

Give us a link to your game (store link) here.

My app was working before but when i submitted my app on the google play store, it said the API level is 25 and should be 26.

I updated corona to the latest version and that fixed the problem.

But when installed the new build of the app it goes to a black screen instead. 

I can not find any of the console logs for my android device.

Here is the game link:

https://play.google.com/store/apps/details?id=com.gotinoapps.rat_hunter

Are you using  adb logcat?

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

Well I can see you didn’t leave debug symbols enabled so this is pretty useless (adb logcat log):

V/Corona ( 4081): \> Class.forName: network.LuaLoader V/Corona ( 4081): \< Class.forName: network.LuaLoader V/Corona ( 4081): Loading via reflection: network.LuaLoader I/Corona ( 4081): Platform: SM-T230NU / ARM Neon / 4.4.2 / Vivante GC1000 / OpenGL ES 2.0 / 2018.3329 / English | US | en\_US | en V/Corona ( 4081): \> Class.forName: \_Corona\_Build\_Number.LuaLoader V/Corona ( 4081): \> Class.forName: shared.google.play.services.base.LuaLoader V/Corona ( 4081): \< Class.forName: shared.google.play.services.base.LuaLoader V/Corona ( 4081): Loading via reflection: shared.google.play.services.base.LuaLoader V/Corona ( 4081): \> Class.forName: \_CoronaSetup.LuaLoader V/Corona ( 4081): \> Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona ( 4081): \< Class.forName: CoronaProvider.licensing.google.LuaLoader V/Corona ( 4081): Loading via reflection: CoronaProvider.licensing.google.LuaLoader I/Corona ( 4081): ERROR: Runtime error I/Corona ( 4081): ?:0: attempt to index a nil value I/Corona ( 4081): stack traceback: I/Corona ( 4081): ?: in main chunk

You’ve got some kind of syntax error in your code.

I’m available to debug this, but doing so it pretty easy so I suggest you do the following.

  1. Install ADB Logcat

  2. Turn on debug symbols in your build.

  3. Uninstall the app from your device

  4. Build and install the app onto your device.

  5. Run ADB logcat console.

  6. Run game.

The log should then show a meaningful message.

To enable debug symbols add this to build.settings:

settings = { ... build = { neverStripDebugInfo = true, }, ... }

… or you can get help: https://forums.coronalabs.com/topic/69420-hire-a-hitman-problem-solver-is-back/

If I were to warrant a guess, you are reading a saved JSON encoded table from disk and trying to access it.  

Most users goof this up by forgetting to handle the, file doesn’t exist yet case.

Just a guess.

Im trying to get adb logcat working but it doesnt work.

I can add that neverStripDebugInfo thing and send you the apk.

I have this in my main.lua file:

local composer = require "composer" local ssk = require "ssk2.loadSSK" ssk.init() local json = require("json") local loadsave = require("loadsave") local main\_variables=loadsave.loadTable( "main\_variables.json" ) if main\_variables.reset == nil then main\_variables = {} main\_variables.highscore = 0 main\_variables.score = 0 main\_variables.lastscore = 0 main\_variables.score\_start=0 main\_variables.reset=nil --main\_varriable.reset is set to 1 in game file. loadsave.saveTable( main\_variables, "main\_variables.json" ) end local appodeal = require( "plugin.appodeal" ) local function adListener( event ) if ( event.phase == "init" ) then -- Successful initialization print( event.isError ) appodeal.show( "banner", {yAlign="top", placement="bannerPlacement"} ) appodeal.load( "rewardedVideo", {placement="rewardPlacement"} ) appodeal.load( "interstital", {placement="intPlacement"} ) end end -- Initialize the Appodeal plugin appodeal.init( adListener, { appKey="notShowing" } ) composer.gotoScene( "maker" )

Anything wrong there?