Ubuntu下cocos2d-x开发环境搭建及配置

1、开发环境及软件

Ubuntu 12.10 + JDK1.7
Android SDK http://developer.android.com/sdk/index.html
Android NDK http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2
Eclipse 下载的Android SDK中已经自带了Eclipse。
cocos2d-2.0-x-2.0.4 http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Download
各自解压,并下载和配置SDK。

2、环境配置
打开cocos2d-x根目录,编辑create-android-project.sh文件,修改NDK_ROOT_LOCAL和ANDROID_SDK_ROOT_LOCAL相应的目录为NDK和SDK的根目录

NDK_ROOT_LOCAL="/home/jiang/soft/android-ndk-r8e"
ANDROID_SDK_ROOT_LOCAL="/home/jiang/soft/adt-bundle-linux-x86-20130219/sdk"

3、创建并运行cocos2d-x项目

3.1、生成项目

运行create-android-project.sh。

输入package path、target id、project name,会自动在当前目录下生成相应的cocos2d-x项目。

$./create-android-project.sh
Input package path. For example: org.cocos2dx.example
com.rollcalf.example

Now cocos2d-x supports Android 2.2 or upper version
Available Android targets:
----------
id: 1 or "android-15"
    Name: Android 4.0.3
    Type: Platform
    API level: 15
    Revision: 3
    Skins: WVGA800 (default), HVGA, QVGA, WVGA854, WXGA720, WQVGA400, WQVGA432, WXGA800, WSVGA
    ABIs : no ABIs.
----------
id: 2 or "Google Inc.:Google APIs:15"
    Name: Google APIs
    Type: Add-On
    Vendor: Google Inc.
    Revision: 2
    Description: Android + Google APIs
    Based on Android 4.0.3 (API level 15)
    Libraries:
      * com.google.android.media.effects (effects.jar)
          Collection of video effects
      * com.android.future.usb.accessory (usb.jar)
          API for USB Accessories
      * com.google.android.maps (maps.jar)
          API for Google Maps
    Skins: WQVGA400, WVGA854, WSVGA, WXGA720, HVGA, WQVGA432, QVGA, WVGA800 (default), WXGA800
    ABIs : armeabi-v7a
----------
id: 3 or "android-17"
    Name: Android 4.2.2
    Type: Platform
    API level: 17
    Revision: 2
    Skins: WVGA800 (default), HVGA, QVGA, WVGA854, WXGA720, WQVGA400, WQVGA432, WXGA800-7in, WXGA800, WSVGA
    ABIs : armeabi-v7a

input target id:
3

input your project name:
myexample

相关推荐