- A Supported OS (Ubuntu 12.10+, OS X 10.7+, Windows 7+)
- Cocos2d-x v3.0 (HERE)
- JDK/SDK 1.6+
- NDK r9d+
- Apache Ant
- Python 2.7.5
-
Download cocos2d-x and unzip it. (maybe: ~/)
-
After downloading it, unzip the SDK and NDK to the same root location. (maybe: ~/AndroidDev)
-
Verify that
Python 2.7
is installed and is accessible -
Install and verify
Apache Ant
(Apache.org) -
Run
setup.py
to configure your Android development environment. This will set the necessary environment variables needed. If you haven't configured this environment before, you will be prompted to enter paths for variables that are not found.
** Caution: You must not use the ~
sign. Use the full path to your home directory. Otherwise, the scripts will fail due to error path value.
** *COCOS2D_CONSOLE_ROOT*
environment variable to point to the bin directory under ~/cocos2d-x/tools/cocos2d-console directory.
** *NDK_ROOT*
environment variable to point to the location of where you put the NDK. (i.e android-ndk-r9d/)
** *ANDROID_SDK_ROOT*
environment variable to point to the location of where you put the adt-bundle
. Example /Users/guanghui/AndroidDev/adt-bundle-mac-x86_64-20130522/sdk/
. The adt-bundle-mac-x86_64-xxxx, the xxxx number maybe different. So please note this non-trival difference.
** *ANT_ROOT*
environment variable to point to the location of where you put apache-ant-x.x.x
. The apache-ant-x.x.x
, the x.x.x number maybe different.
-
In your
cocos2d-x
directory runpython setup.py
-
On *nix systems, now issue the following commands:
source ~/.bash_profile
-
On win32 systems, close the command line windows and restart it.
-
Change your directory to the where the
android-build.py
script is located. (usuallycocos2d-x/build
) -
execute: python android-build.py -p 19 cpp-tests
-
Enable USB Debugging on your phone and then connect your phone via USB.
-
Change your directory to the the bin directory of your android project
-
Use adb to install the apk to your android phone: adb install TestsDemo-debug.apk