v3rc0 on eclipse!

@Chano
Couple months ago I was looking for a way to debug c++ code in eclipse. I was then using cocos2d-x-2.2.2, and this tutorial worked fine for me.

I am currently migrating my project to 3.0rc0 so I haven’t tested it with it yet, but as long as you can run your app on device from Eclipse, it should work the same. If you mix this with the tutorial made by 0owen for 3.0 (linked above), you should be able to to it.

I’ll try it myself when I finish my project’s code migration. In the mean time, I hope it helped.

@traitree
What kind of errors do you have?
Please upload some screenshots.

I am always programming on MacOS, current my workflow is coding on Xcode and build it on console and then install the apk with ecliopse.

@sgleizes
Thanks!

@0owen
forgetting the compilation. most important for me is to write the code and now I can not.

@traitree you can’t add Classes folder to eclipse project?

@lukasz.b
this make many incompatibility, errors…

@0owen wrote:

@traitree
What kind of errors do you have?
Please upload some screenshots.

I am always programming on MacOS, current my workflow is coding on Xcode and build it on console and then install the apk with ecliopse.

I’m completely stucked:( I’ve tried a lot of methods, tutorials and etc. to solve my problem.
So, what I’m doing -

  1. Cocos2dx v3.0rc0, MacOS 10.9
  2. Create new project with cocos new command
  3. cocos run MyNewProject works perfect with ios, mac and android params. Except I don’t have android device to test on.
  4. /MyNewProject/proj.android/build_native.py works fine with 3 warnings.
  5. Open Eclipse.
  6. Import MyNewProject/proj.android
  7. Import Libcocos2dx Project

After these steps I get en error(No rule to make target ‘all’).
Ok, I try to run MyNewProject as Android application on emulator64-arm(Android 4.4.2 API Level 19) and get error again(Fatal signal 11(SIGSEGV) at 0xxxxxx(code=1))

I googled a lot, tried bunch of fixes but no luck…

Could you, please, clarify what I’m doing wrong? I’m pretty sure that to solve first problem I need to use external builder but what build command should I use?

Thank you!

Nik.

When you import your Android project to Eclipse, you must first convert it into a C/C++ Project.

  1. Right-click project, select New > Other.
  2. Select “Convert Android Project to C/C++ Project”.
  3. Select your project in the window that pops up and follow the instructions.
  4. You may choose “No” when asked to open C++ Perspective.
  5. Right-click project again, then select Properties.
  6. Select C/C++ Build.
  7. Under “Build command”, type in “python build_native.py”.
  8. It should build now.

Note that these steps might be inaccurate as I’m typing this off the top of my head.

@anikoy

You just need to right click on the libcocos2dx project and clean it, then build it again.

If it still can’t help, try to turn off the automatic build command and relaunch the eclipse to try the above process until all the error are gone and you should check whether there is a libcocos2dx.jar file under libcocos2dx/bin/ directory or not.

If you still get errors, don’t hesitate to put them on this thread.

@lance_gray wrote:

When you import your Android project to Eclipse, you must first convert it into a C/C++ Project.

  1. Right-click project, select New > Other.
  2. Select “Convert Android Project to C/C++ Project”.
  3. Select your project in the window that pops up and follow the instructions.
  4. You may choose “No” when asked to open C++ Perspective.
  5. Right-click project again, then select Properties.
  6. Select C/C++ Build.
  7. Under “Build command”, type in “python build_native.py”.
  8. It should build now.

Note that these steps might be inaccurate as I’m typing this off the top of my head.

Thanks! But I tried this method couple of times and it didn’t help:( By the way, do we need to do it since in v3.0 c++ supporting in Eclipse is removed? Sorry, it might be a silly question.

@0owen wrote:

@anikoy

You just need to right click on the libcocos2dx project and clean it, then build it again.

If it still can’t help, try to turn off the automatic build command and relaunch the eclipse to try the above process until all the error are gone and you should check whether there is a libcocos2dx.jar file under libcocos2dx/bin/ directory or not.

If you still get errors, don’t hesitate to put them on this thread.

Thanks! But it didn’t help:(

I have the same error. I checked jar file and it seems to be in a right place. Do I need to specify build command for libcocos2dx project?
Now it looks like on screenshot.

Ok, it works now!

For anyone who has similar problem with running new project on Android Virtual Device

  1. Create new project MyGame with cocos console command.
  2. Run \MyGame\proj.android\build_native.py
  3. Open Eclipse with empty workspace.
  4. Right Click on Package Explorer - Import Android\Existing Android Code. Select \MyGame\proj.android folder
  5. Right Click on Package Explorer - Import Android\Existing Android Code. Select \MyGame\cocos2d\cocos\2d\platform\android\java
    Here was my mistake - I’ve imported the same code but from main Cocos2d-X folder which is not inside MyGame folder. And that was the reason I’ve got paths issues.
  6. You can get some mistakes - Clean All, Build All. May be even restart Eclipse.
  7. Add Android Virtual Device. Don’t forget to check Use Host GPU option.
  8. Right Click on MyGame Project in Eclipse. Run As Android Application

After these steps you should get your project working on AVD. if you don’t then try to relaunch your project.
Also you can get your Eclipse hanging on DDMS post init stage. To fix it you should do next steps:

  1. Kill all adb processes with Eclipse.
  2. Go to your Eclipse workspace folder
  3. cd .metadata rm .lock
  4. Launch Eclipse with -clean param.
  5. Clean All, Build All.
    It will help. If it doesn’t - repeat.

Nik.

@anikoy

congratulations!:;ok

@0owen wrote:

@anikoy

congratulations!:;ok

Thanks!:slight_smile:

Any updates on this? I fail at using Eclipse with latest cocos2d-x (3.7)