I’m a Cocos2d-iPhone developer who is thinking about making some cross platform apps with Cocos2d-x.
I just crated a new project using the latest version (v3 rc2).
I’m trying to get the project up and running in Eclipse on OS X. I’m used to Xcode, where you don’t have to spend such an insane amount of time configuring a project and you can get right to coding (the way it should be). Unfortunately Google dev tools seem to be pretty far behind.
Anyway, I have the project set up. But it won’t build because of the following errors:
-Cocos2dxActivity cannot be resolved to a type.
-The import org.cocos2dx.lib cannot be resolved.
I searched around, all the solutions I’ve found seem to say that Eclipse cannot find the Cocos2d-x source files and to click on the project and set up properties and link some file path, which I cannot find, probably because the solutions are outdated?
I just want to get basic set up going in Eclipse. I plan to do most of the coding in Xcode and do the nasty Android specific stuff in Eclipse later.
Okay, so I imported liCocos2dX into the project. But the errors still appear in Eclipse. Now 4 additional warnings show up after I imported the cocos2d lib
But that path COCOS2D-X_INSTALLATION_FOLDER/cocos2dx/platform/android/java/src does not seem to exist in V3 in the installation folder. I see no “platforms” folder in the Cocos2d-x folder. So much seemingly outdated stuff around. Wonder why they don’t just generate a project with all the template code properly set up? Are Google Dev tools really so bad, that basic project templates cannot be created?
Same problem here on Win 7.
It appears to be some eclipse configuration issue.
The project builds / runs using the python scripts from prompt but not from eclipse.
Does your project have settings enabled under the CDT (C++) module under project preferences?
In windows,can it “convert to” does not work and says its not a CDT project
The android Tools > “add native support” option does not appear.
The output of cocos new XXX does not seem to create a .cproject file under proj.android either.
Therefore, the build_native.py doesn’t seem to appear anywhere like the build_native.sh we have in v2.
Suggestions appreciated.
Hello, I read almost every post about this topic, but still can’t manage to run cocos2d-x v3 project on Eclipse. The problem is that C++ code is not resolved and it throws errors. I already converted project to C++ project. And now I must include some folders in properties->C/C++ General->Paths And Symbols->GNU C++. I must include /Users/levani/Documents/android-ndk-r9d/platforms/android-19/arch-arm/usr/include and some kind of cocos2d-2.1/cocos2dx/include folder, but the thing is that in cocos2d-x v3 there is no such folder and I am stuck, can’t find solution. Can anyone help me to resolve C++ code in cocos2d-x v3? http://devcircle.blogspot.com/2013/03/setting-up-cocos2d-x-for-android-game.html I followed this tutorial, but it’s written for older version.
@kusamochi Thanks for answer, I made all the steps but have problem with last one:
“go to C/C++ build, change build command: /usr/bin/python ${workspace_loc:/EclipseTest}/build_native.py 8, Behaviour tab, select checkbox “Build on resource save”, “Build”, “Clean”, but clear all arguments 9, check .project, add the following with other buildCommand”
I selected those 3 checkboxes “Build on resource save”, “Build”, “Clean”. And after this is complete black out for me.
“clear all arguments” - you mean I must delete values next to those checkboxes?
“check .project, add the following with other buildCommand” - is .project some kind of file that I should modify and insert those build command? I can’t locate file with extension .project in android project.
I think by default, “Build” “Clean” is checked, then should be fine. (there you can play around and set it as you like, I think if u don’t clear the value next to checkboxes would also works, not much to worry about there)
yea, you need to edit the .project by hand (with some text editor) because the template project doesn’t have the buildCommand needed for u to just push the “play” button and execute, when u opened up the .project file, there should be other tags exists there, just insert in the right place (I am sure you know how).
PS note that ${workspace_loc:/EclipseTest} “EclipseTest” is your project folder name, I believe u can see it on another text field just below build command on the same screen.
I know it is complicated, but this is the quickest way I’ve found so far.