Cocos2d-js 3.1 Android release build error

Why am i getting an error about jscompile when i try to build on release mode?

> Running command: jscompile
> compiling javascript files to bytecode
> compiling js (src/resource.js) to bytecode...
> Error running command, return code: 2. Check the log file at /home/ezio/.cocos2d/cocos2d.log

/home/ezio/.cocos2d/cocos2d.log

/home/ezio/cocos2djs/tools/cocos2d-console/bin/…/plugins/plugin_jscompile/bin/jsbcc: 1: /home/ezio/cocos2djs/tools/cocos2d-console/bin/…/plugins/plugin_jscompile/bin/jsbcc: Syntax error: “&” unexpected

resource.js

var res = {
    HelloWorld_png : "res/bg.jpg",
    CloseNormal_png : "res/CloseNormal.png",
    CloseSelected_png : "res/CloseSelected.png",
    mon_0 : "res/mon_1.png",
    mon_1 : "res/mon_2.png",
    mon_2 : "res/mon_3.png",
    mon_3 : "res/mon_4.png",
    mon_4 : "res/mon_5.png"
};

var g_resources = [
    //image
    res.HelloWorld_png,
    res.CloseNormal_png,
    res.CloseSelected_png,
    res.mon_0,
    res.mon_1,
    res.mon_2,
    res.mon_3,
    res.mon_4
    //plist

    //fnt

    //tmx

    //bgm

    //effect
];

When i try the debug mode it works!.

Are you having any error reports when you debug with browser ?
My guess is that your code have some issue, with debug mode, it can run. But when you try to release it, js files will be compiled to jsc file, then the issue will block it from compiling.

Hi. I have installed new version too and I have the same problem. My android project is doesn’t work. after compile app is throw error. I tried to compile project which I was creating with help previous version and it works great.

This project did work with the previous versions of cocos2d.

Even the dummy project ( cocos new -l js AAA ) failed to build on release mode. what might be the cause?
I have used the previous versions of cocos2dJS and had no problems building on release mode.

No, there are no error reports when debugging or releasing with browser.

@RasterBrain Can you attach the src folder within the dummy project ? I will check it out, personally, I can’t reproduce the error.

@RasterBrain @san40511

Can you both describe some more details:

  • Which system are you using with which version ?
  • After upgrade to 3.1, have you upgrade your cocos command by running setup.py in 3.1 package ?

It is the HelloWorld projectsrc.zip (1.2 KB)

Ubuntu 14.04 and cocos2d-x-JS 3.1
yes I did run the setup.py

What might be the cause for jscompile to fail even with the HelloWorld project?
Is it something with jscompile or something wrong with system configuration?

Mac Os 10.9.5.
“After upgrade to 3.1, have you upgrade your cocos command by running setup.py in 3.1 package ?” - No I forgot about it ))) . I will try and after send message you about results.

On Linux, we do have an issue with jscompiler, refer to this issue:

https://github.com/cocos2d/cocos2d-js/issues/1082