Monday, March 25, 2013

Setting up Cocos2D for Android Development in Windows 7/8


Introduction

Welcome to my tutorial. This is the first time I'm using Cocos2D for a project so bear with me. First things first, we gotta download the needed files to setup the environment.

We will need the following:

Installation


Install the JDK, Cygwin and notepad++ to their default locations. Extract or install the Android SDK, NDK and Cocos2D to the C:\Andriod Folder. Here's how my C:\Android Folder looks like.



When installing Cygwin, make sure you search and add these packages:

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


Setting up Cygwin


Edit the batch file  create-android-project.bat using notepad++ (right-click on it in Windows Explorer)


Edit _CYGBIN, _ANDROIDTOOLS and _NDKROOT values in the batch file depending on your environment. If you followed what I did, use the configuration below:


Add the following Environment Variable in the end of file home\<youname>\.bash_profile

NDK_ROOT=/cygdrive/C/Android/android-ndk-r8e

export NDK_ROOT

Restart Cygwin.

Executing the Batchfile


Execute the batch from the windows explorer. It will ask you for the project location, set it (something like com.yourproject.something), and then choose the project name and target ID. This will create a folder with the project name inside the cocos2dx installation folder. You should see the execution of a script, without any error, something like this:




To be continued....

Introduction

Hi,

I will post things that I've learned over time as an Independent Developer. Take note, developing software solutions and games is just my hobby.

Thank you,
Homer