[Cocos2d-x Game Engine Development Notes] Releasing games to Android on ubuntu

Source: Internet
Author: User

My environment is ubuntu 12.04, android-ndk-r8, Cocos2d-2.0-x-2.0.4, eclipse 3.7.2


I have set up the NDK development environment before. For the NDK environment, see Android NDK development and configuration NDK.

1. Configure NDK and SDK
Enter the Cocos2d-2.0-x-2.0.4, open the create-android-project.sh with gedit, make the following changes


[Cpp] view plaincopyprint? NDK_ROOT_LOCAL = "/home/zhycheng/android-ndk-r8"
ANDROID_SDK_ROOT_LOCAL = "/home/zhycheng/android-sdk-linux"

NDK_ROOT_LOCAL = "/home/zhycheng/android-ndk-r8"
ANDROID_SDK_ROOT_LOCAL = "/home/zhycheng/android-sdk-linux" specifies the NDK and SDK directories.

Then run the file to generate the andriod project.

2. Compile
Open the. bashrc file and add

Export NDK_ROOT =/home/zhycheng/android-ndk-r8

Go to the android project and run build_native.sh.

[Cpp]
Zhycheng @ zhycheng-Lenovo-B460 :~ /Cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android $./build_native.sh

Zhycheng @ zhycheng-Lenovo-B460 :~ /Cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android $./build_native.sh

The following result is displayed:


[Cpp] view plaincopyprint? NDK_ROOT =/home/zhycheng/android-ndk-r8
COCOS2DX_ROOT =/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android /../..
APP_ROOT =/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android /..
APP_ANDROID_ROOT =/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android
Using prebuilt externals
Make: Entering directory '/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android'
Gdbserver: [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup: libs/armeabi/gdb. setup
Install: libgame. so => libs/armeabi/libgame. so
Make: Leaving directory '/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android' www.2cto.com
Zhycheng @ zhycheng-Lenovo-B460 :~ /Cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android $

NDK_ROOT =/home/zhycheng/android-ndk-r8
COCOS2DX_ROOT =/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android /../..
APP_ROOT =/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android /..
APP_ANDROID_ROOT =/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android
Using prebuilt externals
Make: Entering directory '/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android'
Gdbserver: [arm-linux-androideabi-4.4.3] libs/armeabi/gdbserver
Gdbsetup: libs/armeabi/gdb. setup
Install: libgame. so => libs/armeabi/libgame. so
Make: Leaving directory '/home/zhycheng/cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android'
Zhycheng @ zhycheng-Lenovo-B460 :~ /Cocos2d-2.0-x-2.0.4/cocos2d-2.0-x-2.0.4/CocosGame/proj. android $

 

I have compiled it before. It takes some time to compile it. Finally, libgame. so is generated in the libs/armeabi folder.


3. Run
Import the project to eclipse, copy the org folder under the Coco2d-2.0-x-2.0.4 directory cocos2dx/platform/android/java/src to the android project src directory and start running. Note: you must use a real machine for testing. I encountered an error in testing on the simulator.

Finally, paste an image.

 


There are only 48 frames, much lower than on a pc.

 

 

 

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.