cocos2d-x (iphone-android)/IDE installation and setup under mac os

I’m recenly doing some research on mobile multi-platform game framework and since I’ve been playint with the cocos2d engie for a bit of time I think the cocos2d-x might be a great choice so planned to build the enviroment for both iphone and android under macos.

The whole process is far more tough than I ever thought(not to mention I am using a Hackintosh without internet connection). But, I finally get it done, so I’d like to write all the stuffs down and share it with all those who wanna do the same thing…

Here goes the process:

1.Install the leopard (I got a version of 10.6.5)

2.Install the XCode (I used the 3.2.5 since I don’t like the 4.0 for some reasons)

3.Install for iphone dev(I am using the latest version cocos2d-1.0.0-x-0.9.0)

You can get it here: http://cocos2d-x.googlecode.com/files/cocos2d-1.0.0-x-0.9.0.zip

3.1 Follow the tutorial here:

http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Chapter_1*-*How_to_Create_a_New_cocos2d-x_project_on_multi-platforms

In one word, just run “sudo ./install-templates-xcode3.sh” and that’s all :slight_smile:

4.Install for android dev (this is the toughest part)

4.1 Make sure you have JDK installed

You can input the “java version" in your terminal to check
h4. 4.2 Make sure you have Ant installed
You can input the "ant
version” in your terminal to check

4.3 Install Eclipse

I used the helios version (eclipse-jee-helios-SR1-macosx-cocoa) since it contains some nesscenary plugins (I tried to use the eclipse-SDK-3.7-macosx-cocoa at first but got some problems that’s hard to solve for me)

4.4 Install the ADT plugin

You can follow the instruction here:

4.5 Install the Android SDK

If you got a internet connection than you can just follow this instruction:

But, if you got no internet connection and have to work offline just like me then that’s much more complex:

4.5.1 Download all the neccenary packages

Here is a good instruction to follow:

or

4.5.2 Unpack the packages to the right position

4.5.3 Create && run the emulator

4.6 Install the Andriod NDK (I am using the NDK r5)

You can get it here:

Follow the instruction here:

4.7 Build && Run the Test demo

Follow the instruction here:

http://www.cocos2d-x.org/projects/cocos2d-x/wiki/How_to_run_test_cases_on_android-ndk

4.8 Merging the Android project into the iPhone project

Follow the instruction here:

http://gameit.ro/2011/08/creating-an-iphone-and-android-cocos2d-x-hybrid-project/

And then the whole job is done :slight_smile:

PS: If you are interested you can come to my site and check this out:

http://www.supersuraccoon-cocos2d.com/2011/08/10/cocos2d-x-iphone-androidide-installation-and-setup-under-mac-os/

Update:

My Hackintosh broke up recently and I re-installed the Mac OS and took a video along the way when I do all the stuffs above again.(My audio driver is still not working so I can not record the sound while recording…)

Here’s the video:

For Chinese:

(I don’t know how to embed a video here so sorry :frowning: )

PS:
This is the first time I made a video so there might be some flaw. (hope you don’t mind :slight_smile:

wow, that is great, thank you for your share.

Good job! I have added this link into FAQ & wiki main page.
Also I help you to add images, highlight the titles, wish you would like it.

Walzer Wang wrote:

Good job! I have added this link into FAQ & wiki main page.
Also I help you to add images, highlight the titles, wish you would like it.

That’s great thank you :slight_smile:

And I also have something new to share today :slight_smile:

http://www.cocos2d-x.org/boards/7/topics/3001

And I hope you can help me to adjust the format a little, thanks :slight_smile:

Hi,

Thanks for the detailed instructions and the video. They are very clear and precise. But I even though I have followed all the instructions and imported my project into eclipse, there are some errors. In the main .java file

`protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);

    // get the packageName,it's used to set the resource path
    String packageName = getApplication().getPackageName();
    super.setPackageName(packageName);

    setContentView(R.layout.game_demo);
    mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.game_gl_surfaceview);
    mGLView.setTextField((Cocos2dxEditText)findViewById(R.id.textField));
}`

it says that R is not known to it.

Also, the files Cocos2dxAccelerometer.java and Cocos2dxGLSurfaceView.java have errors in them, as does the AndroidManifest.xml.
If required I can post the related detailed snippets from these files.

I should also mention that Im using Lion OSX and that I created the projected using Android Platform 4.0.3, API level 15.

Any help is appreciated.

Thanks.

R is generated dynamic.
You can build the project to generate it.

Hi

How can I link the resources folder of android with xcode resources folder?