[Cocos2d-x game engine development notes (8)] Release the game to Android on Ubuntu

Source: Internet
Author: User
Tags lenovo

Original article, reproduced please indicate everywhere: http://blog.csdn.net/zhy_cheng/article/details/8276848

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

NDK_ROOT_LOCAL="/home/zhycheng/android-ndk-r8"ANDROID_SDK_ROOT_LOCAL="/home/zhycheng/android-sdk-linux"

Specifies the directory of the ndk and SDK.

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.

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:

NDK_ROOT = /home/zhycheng/android-ndk-r8COCOS2DX_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.androidUsing prebuilt externalsmake: 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/gdbserverGdbsetup       : libs/armeabi/gdb.setupInstall        : libgame.so => libs/armeabi/libgame.somake: 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.

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.