ikh
ikh

Reputation: 10427

cocos2d-x 3.0 rc0 : develop for android in eclipse

I'm on windows xp & Eclipse Kepler. I want to develop with cocos2d-x, but I have some problem.

First, I created project.

cocos new MyGame -p com.myprog.MyGame -l cpp -d MyGame

and I tried run:

cd MyGame
cocos run -s MyGame -p android

and it succeeded.

The problem happens when I open it by eclipse. I create eclipse project, Android Project From Existing Code.

enter image description here

enter image description here

But I can't know what to do next.. even I don't know how to build! (Project - Build doesn't work..)

Moreover, Classes, cocos2dx, extensions and scripting folder are broken..

I tried to find solution, but people are saying about only cocos2d-x 2.x ...

Even if README.md seems to say about 2.x!

Could anyone tell me how do I do?

Upvotes: 2

Views: 3316

Answers (2)

Balakrishnan
Balakrishnan

Reputation: 2441

You can handle it in different way though you are on windows you have to use Microsoft Visual Studio Express 2012 for Windows Desktop its free and also it will give you good IntelliSense support. Every time you edit using MS VS2012 run proj.android/build_native.py and then you can run your app from eclipse as usual.

enter image description here

Upvotes: 0

AnanThDev
AnanThDev

Reputation: 335

Installation Process:

Cocos2d require NDK and Cygwin

First install NDK ->

This links may help you :

http://nikhilvithlani.blogspot.in/2013/07/install-android-ndk-for-windows_6.html

Cocos 2d installation link:

http://www.cocos2d-x.org/wiki/How_to_set_up_the_android_cocos2d-x_development_environment_on_Windows_7

Download cocos 2d version and follow the instruction in above link

This packages you required in cygwin: search and install:

autoconf, automake, binutils, gcc-core, gcc-g**, gcc4-core, gcc4-g**, gdb, pcre, pcre-devel, gawk, make 

After installation cygwin,ndk and you need to config in C/C++ preference in eclipse(Don't forget to install c/c++ plugin in eclipse)

enter image description here

My NDK and PATH is :

NDK_ROOT->C:/android-ndk-r9c

PATH->C:\android-ndk-r9c;C:\Cygwin\bin;

Then import the sample project :

cocos2d-x-2.2.2\samples\Cpp\HelloCpp\proj.android

Import the library :

cocos2d-x-2.2.2\cocos2dx\platform\android\java

enter image description here

Add the library to hello world project

when you import hello world project eclipse automatically include the header files:

bash F:/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/build_native.sh cygwin warning: MS-DOS style path detected: F:\cocos2d-x-2.2.2\samples\Cpp\HelloCpp\proj.android Preferred POSIX equivalent is: /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android CYGWIN environment variable option "nodosfilewarning" turns off this warning. Consult the user's guide for more details about POSIX paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames NDK_ROOT = C:/android-ndk-r9c COCOS2DX_ROOT = /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../.. APP_ROOT = /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/.. APP_ANDROID_ROOT = /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android Using prebuilt externals + C:/android-ndk-r9c/ndk-build -C /cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android NDK_MODULE_PATH=/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../..:/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../../cocos2dx/platform/third_party/android/prebuilt make: Entering directory '/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android' Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Android NDK: WARNING:/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android/../../../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
[armeabi] Install : libhellocpp.so => libs/armeabi/libhellocpp.so make: Leaving directory '/cygdrive/f/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj.android'

After get output in console right click project and goto properties and choose paths and symbols under c/c++ general

enter image description here

Run the project and you can see the output :

enter image description here

Useful links: http://www.youtube.com/watch?v=2itbQceTQGI

Upvotes: 1

Related Questions