Black screen on device.

22 replies [Last post]
Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

Hi,

I didn't test my game on device for some time and now that I test it on a Nexus 7, I get black screen. Needles to say that game works fine in the simulator.

Thins I checked with googling:
1) all files are in the root folder of the app, no folders at all. (The only folder is .svn which is for SVN, but I don't read anything from it).

2) file names are all in lower case. there are some require statements that have uppercase and lowercase combined and I call them just the same way as they are named.

3) there are underscore in my image files but since it's been this way from day 1, I don't suspect it being the problem.

4) My images are in PNG and I don't suspect them being the problem because I haven't changed them in a while and they worked fine on previous builds.

What else should I check?

Replies

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

Additional info:

In my build window, In application name I have a name that is 19 characters and have upper case and lower case characters in it.

My package name is like this: com.deadsomethingthing.mylonggamenamehere

so just in case.

I'm not doing anything strange in my game like showing ads or anything, just simple drag and drop objects around and I use os.time() in several places.

richard9
User offline. Last seen 1 hour 23 sec ago. Offline
Joined: 28 Feb 2011

Android isn't my forte, but I'm guessing the first thing anyone here will ask you is to setup something to get console messages from your device, maybe as described here. In my (admittedly iOS side) experience, when you get a black screen on device and not on simulator, you've made a very specific error that - while not a big deal to solve - could take you a long time to find without simply reading the error message.

(For example, the most common error is improperly calling an asset. I believe the SDK isn't entirely case specific while devices are.)

Rob Miracle
User is online Online
Staff
Joined: 26 Nov 2012

Make sure there are no errors in your build.settings file.

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

Thanks richard, I'm working on make ADB work.

@Rob, I can't see any problems with my build.settings file, would you please take a look?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
-- Supported values for orientation:
-- portrait, portraitUpsideDown, landscapeLeft, landscapeRight
 
settings = {
    
    orientation = {
        default = "landscapeRight",
        supported =
        {
            "landscapeLeft", "landscapeRight"
        }
    },
    
    iphone = {
        plist = {
            UIStatusBarHidden = false,
            UIPrerenderedIcon = true, -- set to false for "shine" overlay
            --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend
            
            --[[
            -- iOS app URL schemes:
            CFBundleURLTypes =
            {
                {
                    CFBundleURLSchemes =
                    {
                        "fbXXXXXXXXXXXXXX", -- example scheme for facebook
                        "coronasdkapp", -- example second scheme
                    }
                }
            }
            --]]
        }
    },
    
        --[[
        -- Android permissions
 
        androidPermissions = {
                "android.permission.INTERNET",
        },
 
    ]]--
}

I'm also using Glider as IDE, are there any reported problems with it?

appsogood.k
User offline. Last seen 1 year 26 weeks ago. Offline
Joined: 22 Jan 2013

There is some errors in your setting file. kindly rectify them also.

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

Thanks. Would you please indicate the error?

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

As I'm super frustrated over this, I removed all iOS settings and reduced it to this:

1
2
3
4
5
6
7
8
9
10
11
settings =
{
        orientation =
        {
                default = "landscapeRight",
                supported =
                {
                        "landscapeLeft", "landscapeRight",
                },
        },
}

That's got to be right, right?

Anything else?

ingemar
User offline. Last seen 6 hours 38 min ago. Offline
Joined: 20 Jun 2011

This seems like the time to look at the logcat.

While having your device connected via USB you can do an 'adb logcat' from the command line before starting your app (assuming you have the Android SDK installed).
You'll be able to see if any errors are reported while running your app...

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

As I don't have access to a device, I installed my apk itno AVD (android SDK emulator) and got this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
E/AndroidRuntime(  525):        at com.ansca.corona.JavaToNativeShim.<clinit>(JavaToNativeShim.java:93)
E/AndroidRuntime(  525):        ... 14 more
W/ActivityManager(   69):   Force finishing activity com.dnsgames.games.shm/com.ansca.corona.CoronaActivity
W/ActivityManager(   69): Activity pause timeout for HistoryRecord{4075eaf0 com.dnsgames.games.shm/com.ansca.corona.CoronaActivity}
D/dalvikvm(   69): GC_EXPLICIT freed 160K, 59% free 4347K/10375K, external 5835K/6312K, paused 251ms
I/WindowManager(   69): Setting rotation to 0, animFlags=1
I/ActivityManager(   69): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=25}
I/Process (  525): Sending signal. PID: 525 SIG: 9
I/ActivityManager(   69): Process com.dnsgames.games.shm (pid 525) has died.
W/InputManagerService(   69): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@408a5998
D/dalvikvm(   69): GC_EXPLICIT freed 38K, 59% free 4326K/10375K, external 4669K/5830K, paused 114ms
W/ActivityManager(   69): Activity destroy timeout for HistoryRecord{4075eaf0 com.dnsgames.games.shm/com.ansca.corona.CoronaActivity}
I/ActivityManager(   69): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.dnsgames.gam
es.shm/com.ansca.corona.CoronaActivity } from pid 227
I/ActivityManager(   69): Start proc com.dnsgames.games.shm for activity com.dnsgames.games.shm/com.ansca.corona.CoronaActivity: pid=538 uid=10034 gid
s={3003}
I/WindowManager(   69): Setting rotation to 1, animFlags=1
I/ActivityManager(   69): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=1/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=26}
I/ActivityThread(  538): Pub com.dnsgames.games.shm.files: com.ansca.corona.FileContentProvider
W/dalvikvm(  538): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/ansca/corona/JavaToNativeShim;
D/AndroidRuntime(  538): Shutting down VM
W/dalvikvm(  538): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime(  538): FATAL EXCEPTION: main
E/AndroidRuntime(  538): java.lang.ExceptionInInitializerError
E/AndroidRuntime(  538):        at com.ansca.corona.CoronaActivity.onCreate(CoronaActivity.java:166)
E/AndroidRuntime(  538):        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(  538):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime(  538):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime(  538):        at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(  538):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime(  538):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(  538):        at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime(  538):        at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(  538):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(  538):        at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(  538):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(  538):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(  538):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(  538): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load lua: findLibrary returned null
E/AndroidRuntime(  538):        at java.lang.Runtime.loadLibrary(Runtime.java:429)
E/AndroidRuntime(  538):        at java.lang.System.loadLibrary(System.java:554)
E/AndroidRuntime(  538):        at com.ansca.corona.JavaToNativeShim.<clinit>(JavaToNativeShim.java:93)
E/AndroidRuntime(  538):        ... 14 more
W/ActivityManager(   69):   Force finishing activity com.dnsgames.games.shm/com.ansca.corona.CoronaActivity
W/ActivityManager(   69): Activity pause timeout for HistoryRecord{4073be28 com.dnsgames.games.shm/com.ansca.corona.CoronaActivity}
D/dalvikvm(   69): GC_EXPLICIT freed 55K, 58% free 4365K/10375K, external 5064K/5830K, paused 260ms
I/WindowManager(   69): Setting rotation to 0, animFlags=1
I/ActivityManager(   69): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=1/1/2 nav=3/1 orien=1 layout=34 uiMode=17 seq=27}
D/dalvikvm(   69): GC_EXPLICIT freed 16K, 58% free 4361K/10375K, external 5055K/5830K, paused 110ms

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

I've searched around this I think the error in the AVD is due to it, probably, being Arm v6 and perhaps it's not my original error.

If there is no way to make AVD to simulate a Arm 7 device, I have to find a physical device.

ingemar
User offline. Last seen 6 hours 38 min ago. Offline
Joined: 20 Jun 2011

If you download the Google API's for Android 4.1.2 (in the Android SDK manager) you should be able to select "Nexus 7" from the device list in the AVD manager.

Also make sure that the CPU is set to "ARM (armeabi-v7a)"
If you're on Mac you should also select "Use Host GPU" for the device to work properly.

EDIT:
You'll also need to install the "ARM EABI v7a System Image" from the Android SDK Manager

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

I got the ADB working and when I run ADB with adb logcat Corona:v *:s command, command prompt just says I/Corona  ( 3541): waiting for connection... and the screen is black.

ingemar
User offline. Last seen 6 hours 38 min ago. Offline
Joined: 20 Jun 2011

I have no idea what that means.

What do you get if you just do adb logcat before starting your app?
It will be very verbose, but there might be some other events that could give a clue to what's happening...

EDIT:
I just set up a Nexus 7 device in AVD manager and installed one of my apps in the emulator to see what's happening.
The app is behaving as expected with no weird stuff going on, and the logcat output looks OK...

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

Problem was the IDE I was using, when I built my program by manually running Corona simulator, it went fine but for educational purposes I'm eager to know why that debug process with adb went that way that I posted earlier so I can learn from all this for future "black screen of DEATH" situations.

Thanks.

ingemar
User offline. Last seen 6 hours 38 min ago. Offline
Joined: 20 Jun 2011

Aha, so it's a Glider IDE issue?

Unfortunately I can't help with that since I don't use it.
Maybe something that can be reported to M.Y.Developers?

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

I think the bug was something very serious that I running abd logcat didn't result much.

develephant
User offline. Last seen 2 weeks 1 day ago. Offline
Joined: 6 Dec 2012

Interesting...

This may not be an isolated instance. I'm still researching, but oddly starting last evening I started getting a black screen last night on an app that was working fine previously. It seems that it's only android 4 devices that are failing. It will install fine on my old Kindle Fire, but not my other 2 Android 4 devices. Again, was working fine the day before.

I'm about to run adb and see what's up. I do build directly from Corona tool, and I do not use Glider ATM.

Aidin
User offline. Last seen 32 weeks 1 day ago. Offline
Joined: 21 Dec 2012

@delephant: This may help you in some way that I got black screen on both Android 3 and Android 4 tablets.

develephant
User offline. Last seen 2 weeks 1 day ago. Offline
Joined: 6 Dec 2012

Hmm, yeah old KF is running 2.3.3 so that seems to be working.

Looking into it...

Also, everything works fine in the emulator.

develephant
User offline. Last seen 2 weeks 1 day ago. Offline
Joined: 6 Dec 2012

So here is the adb dump, if anyone can see the issue:

Removed, see next post...

develephant
User offline. Last seen 2 weeks 1 day ago. Offline
Joined: 6 Dec 2012

Well I solved my black screen issue. I'm not sure if you have a similar situation, but in my case it was a physics.setGravity() issue.

Why this works on pre-Android 3 is a mystery. Anyway...

Will cause crash (BlackSOD) on Android 3-4, works fine in Android 2.3.3 and emulator:

1
2
3
local physics = require( "physics" )
physics.setGravity( 0, 11 )
physics.start()

Will work on everything (it seems):

1
2
3
local physics = require( "physics" )
physics.start()
physics.setGravity( 0, 11 ) -- start physics, then set gravity

Hope that helps someone.

ingemar
User offline. Last seen 6 hours 38 min ago. Offline
Joined: 20 Jun 2011

@develephant
Good to know...

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.