Cococs2d-js 3.8.1 android black screen with gl stats and framerate

My application runs fine when compiled and run on web. However, when I compile and run on android my application shows a blank screen with gl verts, framerate, etc…

My code is over 12000 lines long so it is not feasible to provide here. I am building with android-23, using the latest jdk, using ndk-r10c, and ant-1.9.4. It appears that the resources are being packaged as the size of the apk is about 50mb larger than the total size of the resources.

My real problem is my inability to debug anything on the android version. Are there any logs that can help me figure out why nothing is happening? I’m not hearing audio or seeing any sprites.

Please advise.

You must be missing loading.js in “res” folder.

No. It’s definitely there. Are the contents important? I haven’t changed it since I created the new project.

EDIT:

I discovered the problem. Cocos2d-js has some stupid discrepancies between web and mobile with regards to how many things are handled. For instance…

Instead of this, which works on a web build:
var sprite = cc.Sprite.create(res.sprite_image_url);

The mobile build would only work when declaring a sprite with the “new” operator:
var sprite = new cc.Sprite(res.sprite_image_url);

Instead of ignoring the instance syntax (or giving some sort of meaningful debug feedback) and continuing to display the rest of the scene, the build will actually choke and give you a black screen with the GL verts and FPS.

Additionally, if you’re having problems with runAction not working inside of event listeners (touch, mouse, etc…) on mobile devices it may be because of a change that was made in version 3.0a where the standard runAction functionality was changed in the JSB so now you are required to use something called a NodeGrid in order to correctly use runAction. However, the standard runAction functionality was left in for cocos2d-html5. This means if you’re developing on cocos2d-html5 in order to save time and building out to mobile later you will run into a shit ton of problems and you’ll have to comb through your code to refactor for the mobile version. Whoever made the decision to change this in the JSB and leave it alone in html5 made a lot of developers’ lives way more difficult.

I sure hope this helps someone because this “community” is a joke when it comes to support.

1 Like