2013-03-05 03:49:01 +08:00
|
|
|
## Prerequisites:
|
|
|
|
|
|
|
|
* Android NDK
|
|
|
|
* Android SDK **OR** Eclipse ADT Bundle
|
|
|
|
* Android AVD target installed
|
|
|
|
|
|
|
|
## Building project
|
|
|
|
|
|
|
|
There are two ways of building Android projects.
|
|
|
|
|
|
|
|
1. Eclipse
|
|
|
|
2. Command Line
|
|
|
|
|
|
|
|
### Import Project in Eclipse
|
|
|
|
|
2014-05-08 11:20:25 +08:00
|
|
|
####Step 1: C/C++ Environment Variable `NDK_ROOT`
|
2013-03-05 03:49:01 +08:00
|
|
|
|
2014-05-08 11:20:25 +08:00
|
|
|
* Eclipse->Preferences->C/C++->Build->**Environment**.
|
|
|
|
* Click **Add** button and add a new variable `NDK_ROOT` pointing to the root NDK directory.
|
|
|
|
![Example](https://lh3.googleusercontent.com/-AVcY8IAT0_g/UUOYltoRobI/AAAAAAAAsdM/22D2J9u3sig/s400/cocos2d-x-eclipse-ndk.png)
|
|
|
|
* Only for Windows: Add new variables **CYGWIN** with value `nodosfilewarning` and **SHELLOPTS** with value `igncr`
|
2013-03-05 03:49:01 +08:00
|
|
|
|
2014-05-08 11:20:25 +08:00
|
|
|
####Step 2: Adding and running from Eclipse
|
2013-03-05 03:49:01 +08:00
|
|
|
|
2013-03-22 02:06:58 +08:00
|
|
|
![Example](https://lh3.googleusercontent.com/-SLBOu6e3QbE/UUOcOXYaGqI/AAAAAAAAsdo/tYBY2SylOSM/s288/cocos2d-x-eclipse-project-from-code.png) ![Import](https://lh5.googleusercontent.com/-XzC9Pn65USc/UUOcOTAwizI/AAAAAAAAsdk/4b6YM-oim9Y/s400/cocos2d-x-eclipse-import-project.png)
|
2013-03-05 03:49:01 +08:00
|
|
|
|
2013-03-22 02:06:58 +08:00
|
|
|
1. File->New->Project->Android Project From Existing Code
|
2014-05-08 11:20:25 +08:00
|
|
|
2. **Browse** to your project directory and Add the project
|
|
|
|
3. Click **Run as Android Application** to run on connected device or emulator.
|
2013-03-05 03:49:01 +08:00
|
|
|
|
2014-05-08 11:20:25 +08:00
|
|
|
That's all !!!
|
2013-03-05 03:49:01 +08:00
|
|
|
|
|
|
|
### Running project from Command Line
|
|
|
|
|
2014-05-08 11:20:25 +08:00
|
|
|
$ cd NEW_PROJECTS_DIR/MyGame
|
|
|
|
$ cocos run -p android -j 4
|