Setting up Cocos2d-x 3.8 Android Game Development Environment on Windows 8 (7)



Cocos2d-x 3.8 Android Game Development


     In this tutorial, we will configure Cocos2d-x android environment on Windows 7 and Windows 8.1. Cocos2d-x is an epic game development tool for making 2D games.

There are many game engines out there, Cocos2d-x is one of the top game development tools. It’s a cross platform tool, which helps to build iPhone, Android and Windows applications. Let us see how to install the tool in Windows powered system. You must have some extra softwares for making games with Cocos2d-x on Windows platform.


Prerequisites for Cocos2d-x Android Development (Windows)

1. Python (2.7 recommended)
2. Android NDK
3.Android SDK + Eclipse
4. Apache ANT
Install Python version 2.7
Download and install Python in Windows

Extract Android NDK

Download the NDK single file and extract it to any folder of your drive.
I hope you have already installed Android SDK+Eclipse on your computer.

Download Apache ANT

Download and extract Apache ANT (1.9) to a folder.

Download Cocos2d-x

Download Cocos2d-x and extract to a folder.

Set up environment variables for Cocos2d-x (Windows 7 or 8.1)

Edit Path variable for Python, Open Control Panel >> System >> Advanced >> Environment Variables and add Python path to ‘Path’ variable value as below.
Select ‘Path’ from System variables and click edit, add ;C:\Python27\ to the string. OK done.
Create new environment variables
Variable Name : NDK_ROOT
Value : D:\Dev\GameDev\NDK\android_ndk (NDK extracted location)
Variable Name : COCOS_CONSOLE_ROOT
Value : D:\Dev\GameDev\cocos-2d\cocos-2d-x\tools\cocos2d-console\bin\
Variable Name : ANDROID_SDK_ROOT
Value : D:\Dev\Android\sdk2\adt\sdk
Variable Name : ANT_ROOT
Value : D:\Dev\GameDev\ant\bin

Run the setup file

setup.py file is included in extracted cocos-2d-x folder (eg D:\Dev\GameDev\cocos-2d\cocos-2d-x )
Open command prompt and run the file
pyhon setup.py 

Restart your computer.

Create a multi-platform 2D game in Cocos2d-x

Open command prompt (Win+R type ‘cmd’) and locate cocos2d-console (eg D:\Dev\GameDev\cocos-2d\cocos-2d-x\tools\cocos2d-console\bin)
Create a game named as ‘Jumpo’
cocos.py new Jumpo -p com.bigknol.jumpo -l cpp -d D:\Dev\Games\jumpo
-l specify the language and -d defines the location of the files.
Make a native build



Python build_native.py
Import to Eclipse
You should import libcocos2dx and proj.android from your game build.

Check the library of game project

Run your project, your installation is completed.
Wow! You are done!
Setting up Cocos2d-x 3.8 Android Game Development Environment on Windows 8 (7) Setting up Cocos2d-x 3.8 Android Game Development Environment on Windows 8 (7) Reviewed by Nikin on 16 January Rating: 5
Powered by Blogger.