Build Cocos2d-x's Android development environment on eclipse

Source: Internet
Author: User

a lot of other related content please check my blog:http://www.bokeyi.com/ll/category/cocos2d-x/


The building method of this article is the newest and most correct method, a lot of friends reflect the building Eclipse Cross-compilation environment is very complex and headache, in fact, only the online data is too fragmented, a step wrong and thousands of miles ah, not to say, assuming you read this article, congratulations, you saved at least The life of the hour.

My operating system:WIN7

Eclipse Version number:eclipse-jee-kepler-sr2-win32

Cocos2d-x Version number:2.2.3

OneAndroidEnvironmental Construction andNDK

1.Androidenvironment construction (includingJDK,Android SDK,Eclipse,ADT,CDT. See details of the attached document tutorial)
2.NDK: Download Unzip the latest versionNDKYes (I'm going to do the following:android-ndk-r9d), extracted to theD:\Android\android-ndk-r9d

Second, on EclipseCocos2d-x's Android development environment

Download cocos2d-x:http://www.cocos2d-x.org/download, I downloaded the 2.2.3 version number, and then extracted directly to:D : \android\cocos2d-x-2.2.3

( 1 ) Import Demo sample project hellocpp LIBCOCOS2DX  , here must be careful not copy to work folders, with references, otherwise there will be very many path problems.
this time hellocpp will not compile through, to do some compile configuration.

(2) window->preferences->android->ndk in eclipse The installation path for the NDK configuration under the menu is:D:\Android\android-ndk-r9d

(3) window->preferences->general->workspace-> in eclipse Linked Resources add? Reference Address:
Cocos2dx
D:\Android\cocos2d-x-2.2.3

( 4 ) In eclipse window->preferences->c/c++->build->envionment ndk_module_path and ndk_root
ndk_module_path
d:\android\cocos2d-x-2.2.3;d:\android\cocos2d-x-2.2.3\cocos2dx\ PLATFORM\THIRD_PARTY\ANDROID\PREBUILT
ndk_root
d:\android\android-ndk-r9d

( 5 ) In eclipse hellocpp Project click right ->properties , click c/c++->build Span style= "font-family: Arial", builder settings Span style= "font-family: Arial" > tab build command Span style= "font-family: Arial" to:
d:\android\android-ndk-r9d\ndk-build.cmd

(6) Changes to the projectjni/application.mk:
Inlocal_src_files: = hellocpp/main.cpp \
.. /.. /classes/appdelegate.cpp
I wrote all of them in the back.CPPThe file name. (Here becauseHellocppThe project has already written in the required documents, so the project does not have to be changed)
(7) WillHellocppthe project's resource files are copied toAssetsfolder, I'm here to putD:\Android\cocos2d-x-2.2.3\samples\Cpp\HelloCpp\Resources\iphonethe picture in the folder is copied.
(8) LetHellocppReferencesLIBCOCOS2DXLibrary (HellocppThe project is already referenced by default)
Okay, now you can connect your phone directly.Runup, you'll seelibs/armeabi/folder is generated under thelibxxx.so.


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.