App runs ok in simulator - completely black on Android device

Hi,

I’m writing a simple game which runs just fine in the simulator (Starter V2014.2189). I can build it for Android wihtout any error messages.

But when installing the resulting apk on an Android device it results in a completely black screen.

Before I start uploading code etc here, I’d like to confirm something first:

Certain Corona features are not supported by the lower priced SDK versions (and certainly not the free version). But I would get a warning at build time if I have used such features, right? Because I do not get any such warning at build time.

99% chance that the case of your files are not correct. The simulator is not case sensitive but devices are.

You need to use basic device debugging to see what is going on: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks for the tip!

After your tip about the cases I’ve gotten rid of all upper case file names, but even then it fails.

running “adb logcat Corona:v *:s” I got two file not exist warnings. One of them looks like this:

V/Corona  (15523): WARNING: Asset file “effect_gfx\explosion.png” does not exist.

Now, the strange thing is that it does exist. I thought maybe it was a slash/backslash problem (UNIX/Windows) but I do not get any error messages for other files in these folders.

Or maybe I only get a message for the first file in a folder to fail? Do I have to use a flat file structure?

You probably think I’m a jerk but check again :slight_smile:  The file is .png and not .PNG for example.

Hehe - definitively not a jerk  :stuck_out_tongue:

I did a new check, 2xcheck etc and they all look good.

But it looks like it IS the UNIX/Windows thing. I created a global called ON_DEVICE. Then I made a construct which looks (more or less) like this wherever I load a file:

if (ON\_DEVICE) then   img = display.newImage("level\_gfx/image.png") else   img = display.newImage("level\_gfx\\image.png") end  



 

And lo and behold! this seems to actually work! At least i see something on the screen (doesn’t work perfectly, but that is another story).

So I guess the usage of sub folders is something one should take extra care about!

Many thanks for the heads-up about the loading of files!

Great you got it working. I have not heard of this problem before and you definitely should not need a constructor like that. Does it not just work on the simulator if you use ‘/’ always instead? 

Arrgh… it seems to work on both the simulator and the device with “/”.

Who’s the jerk now?  :stuck_out_tongue:

Its logical to use \ when you develop on Windows though :slight_smile:

Yes, I guess the Corona simulator does an internal interpretation to make it run under Windows… Maybe it should issue a warning for simple minds like me when the “” is used in file names…

Only and correct way to access resource is via ‘/’, doesn’t meter what platform - Corona probably handles it. Problem is when you try to access subderectories in temp or documents directory. Then I suggest using lfs, becsuse I remember having some issues with ‘/’ and ‘\’.

99% chance that the case of your files are not correct. The simulator is not case sensitive but devices are.

You need to use basic device debugging to see what is going on: http://coronalabs.com/blog/2013/07/09/tutorial-basic-debugging/

Thanks for the tip!

After your tip about the cases I’ve gotten rid of all upper case file names, but even then it fails.

running “adb logcat Corona:v *:s” I got two file not exist warnings. One of them looks like this:

V/Corona  (15523): WARNING: Asset file “effect_gfx\explosion.png” does not exist.

Now, the strange thing is that it does exist. I thought maybe it was a slash/backslash problem (UNIX/Windows) but I do not get any error messages for other files in these folders.

Or maybe I only get a message for the first file in a folder to fail? Do I have to use a flat file structure?

You probably think I’m a jerk but check again :slight_smile:  The file is .png and not .PNG for example.

Hehe - definitively not a jerk  :stuck_out_tongue:

I did a new check, 2xcheck etc and they all look good.

But it looks like it IS the UNIX/Windows thing. I created a global called ON_DEVICE. Then I made a construct which looks (more or less) like this wherever I load a file:

if (ON\_DEVICE) then   img = display.newImage("level\_gfx/image.png") else   img = display.newImage("level\_gfx\\image.png") end  



 

And lo and behold! this seems to actually work! At least i see something on the screen (doesn’t work perfectly, but that is another story).

So I guess the usage of sub folders is something one should take extra care about!

Many thanks for the heads-up about the loading of files!

Great you got it working. I have not heard of this problem before and you definitely should not need a constructor like that. Does it not just work on the simulator if you use ‘/’ always instead? 

Arrgh… it seems to work on both the simulator and the device with “/”.

Who’s the jerk now?  :stuck_out_tongue:

Its logical to use \ when you develop on Windows though :slight_smile:

Yes, I guess the Corona simulator does an internal interpretation to make it run under Windows… Maybe it should issue a warning for simple minds like me when the “” is used in file names…

Only and correct way to access resource is via ‘/’, doesn’t meter what platform - Corona probably handles it. Problem is when you try to access subderectories in temp or documents directory. Then I suggest using lfs, becsuse I remember having some issues with ‘/’ and ‘\’.