Cocos2d-x learning Transcript: compile iOS project into Andriod Project

Source: Internet
Author: User

1. Build an Android Environment

1. Install Andriod-NDK (Native Development Kit)

Create a new folder (eg: NDK), decompress Android-NDK, and put the decompressed file and compressed package in a directory (eg: In NDK ).

2. Install cocos2d-x

Unzip the cocos2d-x source file to any directory (usually put together with your Workspace ).

Modify the create-android-project.sh file to modify the values of NDK_ROOT_LOCAL and ANDROID_SDK_ROOT_LOCAL, as shown below:

NDK_ROOT_LOCAL = "/NDK/android-ndk-r8c" (NDK path)

ANDROID_SDK_ROOT_LOCAL = "/Users/tfmacmini02/android-sdk-macosx" (Android SDK (Mac OS X platform) path)

 

1. Go to the cocos2d-x source file directory and execute the cocos2d-x file (./create-android-project.sh) under the create-android-project.sh to create the android project.

Eg: TF-no-Mac-mini: cocos2d-x-2.1.5 tfmacmini02 $./create-android-project.sh

2. Enter the package name and Bundle identifier of the. plist file in the iOS project.

Eg: Input package path. For example: org. cocos2dx. example

Net. twinfish. DragGame

3. Select the version supported by Android.

Eg:Now cocos2d-x supports Android 2.2 or upper version

----------
Id: 1 or "android-8"
Name: IOS 2.2
Type: Platform
API level: 8
Revision: 3
Skins: HVGA, QVGA, WQVGA400, WQVGA432, WVGA800 (default), WVGA854
ABIs: armeabi
----------
Id: 2 or "Samsung Electronics Co., Ltd.: GALAXY Tab Addon: 8"
Name: GALAXY Tab Addon
Type: Add-On
Vendor: Samsung Electronics Co., Ltd.
Revision: 1
Based on Android 2.2 (API level 8)
Skins: WVGA854, WQVGA400, GALAXY Tab (default), HVGA, WQVGA432, WVGA800, QVGA
ABIs: armeabi

Eg: input target id:

1

4. Enter the project name

Eg:Input your project name:

5. Android project is created, and the corresponding Android project is generated under the cocos2d-x directory.

 

NOTE:

1) after the project is createdLower(The Classes created by iOS are all stored under the Classes), and all the files are copied to the Classes under the Andriod project,

Also, all copies under Resources (however, Resources under iOS may have multi-level directories. Android files can only be stored under Resources but not molecular Directories ).

2 ),

 

 

 

6. compile the project and enter the proj. android directory under the project.

Eg: TF-no-Mac-mini: cocos2d-x-2.1.5 tfmacmini02 $ cd DragGame/proj. android/

 

NOTE:

ModifyBuild_native.sh file, add the following statement to the top.

Export NDK_ROOT =/NDK/android-ndk-r8c

 

7. Execute the build_native.sh file for compilation (./build_native.sh). It may take several minutes.

Eg:

Prebuilt: libwebsockets_static.a <=/Users/tfmacmini02/Projects/cocos2d-x-2.1.5/DragGame/proj. android/.../external/libwebsockets/android/./lib/armeabi/
StaticLibrary: libextension.
SharedLibrary: libgame. so
Install: libgame. so => libs/armeabi/libgame. so
Make: Leaving directory '/Users/tfmacmini02/Projects/cocos2d-x-2.1.5/DragGame/proj. android'

8. Then you can import. However, you must import the platprom/Android/java file (cocos2d-x's andriod platform support file ).

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.