Black screen when running on real Android device

I am creating a new game, when I run it with the creator coconuts simulator it works correctly and does not generate any type of error or warning, but when I generate the apk and install it on an android device, when the game starts it stays on the black screen .

If I execute it by means of the QR code in the device, this error is output and it is not executed either

Uncaught type error: Can not read property “_assembler” of null
/app/engine/bin/cocos2d-js-for-preview.js:40540:38

There is a way in which you can run the app directly on the device and identify why it stays on the black screen by viewing the log?

You should enable developer options on your phone if you haven’t already, as well as adb for your PC.

Then:
Connect your device and your pc.
On your android device, allow your PC to debug the device.
Open a command line on your PC
If the apk is already installed on your device, type the following commands in the command line:
adb logcat -b all -c (This clears all previous logs which your android device might have created. This is to keep the coming output small)
adb logcat *:E (This is to only show Error messages from all log buffers)

Then run your app. You should see any caused error messages in the command line.

Hope this helps. If you have any further questions, just ask :slight_smile:

good afternoon, @Orlan thanks for the information, I have a question, I have installed adb and the phone in debug mode, if I execute
adb devices
appears connected phone, but in cocos creator I can not see the phone to run the game in, if I use the button to refresh connected devices nothing happens and from the play button, only appears the option to run in simulator and web.

Is there any other adjustment that should be made?

lol, it is midnight at my place :smiley:

Anyways, I don’t know that to be honest. The way I did it was:
Build the apk and install it on the phone
Run it on the phone while the logcat is shown

You could try “Project” -> “Play on Device” in Cocos Creator, maybe that works.

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.

Good morning, that option works very well and I can see that if it is generating an error, when launching the app, I will generate another thread to see if you can help me identify where the failure may be, since I think this is associated with some error with some variable

1 Like