How to run cocos2d-x JSB program (Debug Native)

I’m trying to debug my Cocos Creator project on android device. I follow instruction here. And finding a way to run cocos2d-x JSB program.

Well there is a link here at “Run cocos2dx JSB programs” that point to how to run but the link is broken.

I tried running the jsb-default folder from the cocos command line. Using this command and turn out it didn’t work.

cocos run -s "D:\temp\LearnSdkbox\build\jsb-default" -p android

Result:
Ask forum debug native

Could someone that has successful run cocos2d-x JSB program guide me the steps?
Thank in advance.

Hi, I tried too a few months ago but didnt work. I asked the dev team and they told me that a new version of JSB debug was coming. So I guess it is not working and we have to wait.

@jrosich the error is nothing about debugging, but yep, new debugger is coming soon.

@bnut it is because Android remove some commands that cocos command depends on, so you should use android studio instead.

cocos run -s "D:\temp\LearnSdkbox\build\jsb-default" -p android-studio

This command doesn’t work.

cocos run -s "D:\temp\LearnSdkbox\build\jsb-default" -p android-studio 

I use this instead.

cocos run -s "D:\temp\LearnSdkbox\build\jsb-default" -p android --android-studio

But still doesn’t work it said “Unknown engine version!”
I have cocos2d-x installed. But my project is Cocos Creator project

  • cocos2d-x-3.16
  • Cocos Console 2.3

Note that the jsb-default is the folder that Cocos Creator generated from build.

Ask forum debug native 2

Aaaaah! I got it. The sentence “Run cocos2d-x JSB program on Android devices” in the documentation means I just have to run the .apk that Cocos Creator generated after compile the project on Android device.

That is

  1. Copy apk file to your Android device.
  2. Install it.
  3. Open it by tapping your game icon.

There is nothing to do with command line at all. Hahaha.

I don’t know whether myself or the documentation itself make me understand the wrong point. But I think the documentation should be more beginner friendly. Since of course beginner don’t know what is JSB program unless they have used Cocos2d-x or Cocos Creator for a some amount of time.

Thank you for helps :smiley:

1 Like