Cocos Code 2.0 configuration

I just downloaded it, and I tried to run a Lua project. When I hit the make project button, it showed this.

Then it leaded me to this window.


I went to check in the SDKs tap, and it seemed that there’s no Lau SDK settings.

How can I make this to work? Is there a tutorial for Cocos Code 2.0? I checked on the tutorial site, it has only for 1.2.0.

I have got the same error. I have added to the list Android SDK, Java SDK 1.6 and Java SDK 1.7, but for the project you need to select one main SDK. I do not know which one they want.

This is how I set up my (old-structured) lua project for debug in intelliJ on windows 7:
Build your game exe in Visual Studio (or cocos command line).
Note that if you did not create your game with ‘cocos new’ your game must still include simulator and debugging c/cpp files just like a new lua project created with the latest ‘cocos new’. In particular for my old-structured project I had to:

  • Replace my main.c and AppDelegate.cpp with those from a lua project created with cocos new
  • In CodeIDESupport.h define CC_CODE_IDE_DEBUG_SUPPORT as 1

Install cocoos code ide 2.00 and set up with inspiration from the page at the url:
http://www.cocos.com/doc/article/index?type=code-ide&url=/doc/cocos-docs-master/manual/code-ide/install-idea-zh.md
which, if you don’t read Chinese, you can put into google translate…

In IntelliJ:

  • Create a new Lua project - probably with same name as your game. (It will be created on disk under C:/Users/your name/IdeaProjects)
  • Run->EditConfiguration->Click ‘+’ and add a Lua Binding (if not already have one)
  • In the Lua Binding->Simulator-path, Browse to your game exe - this can be anywhere - but by default it is nowadays in the Runtime folder of your game.
  • Copy all your lua files to ‘src’ folder in intelliJ project.
  • Note that config.json (in your project) points to your entry Lua script (currently src/main.lua) - note also that changing the lua entry file name from main.lua to somthing else was fine for me (my entry script has a different name), but putting it anywhere but ‘src’ caused problems (debugging slowed dramatically).

And then it basically worked - I did have to think about my (custom) Resource and Writable folders - but the debugger worked fine already, in Windows at least, and crucially, starts up in about 3 seconds and does not slow my game execution noticeably (I actually use the release version of my game as the simulator because it runs faster).

Basic lua syntax checking in real time works (shows red if incorrect) and even though (currently):

  1. A miss-typed cocos call causes a hang (solved usually by closing simulator window)
  2. Code completion is not there yet
    for me this ide is already a better development solution than either Decoda which takes a long time to restart program (typically 30 seconds now for me) or Mobdebug which greatly slows the game execution.

Note that I get occasional java assert in the intelliJ console window - something about break points - and deleting all my breakpoints fixes this.
Also - don’t leave the simulator running in another intelliJ project or you won’t be able to connect in the one you are developing!

Good luck. :slight_smile: