Cocos2d-x Environment Building for Eclipse

Source: Internet
Author: User


Install Cygwin add ndk_root environment variable in Cygwin home/(user)/.base_profile
ndk_root=/cygdrive/d/android/android-ndk-r8e
Export Ndk_root


Open the Cocos2d-x directory and locate the file Create-android-project.bat open.
See these lines
:: Modify it to work under your environment//modify this directory to point to your Cygwin bin directory
Set _cygbin=e:\cygwin\bin
If not exist "%_cygbin%" echo couldn ' t find Cygwin at "%_cygbin%" & Pause & Exit 4
:: Modify it to work under your environment//modify this directory to point to the tools directory of your Android SDK
Set _androidtools=e:\android\android-sdk\tools
If not exist "%_androidtools%" echo couldn ' t find Android SDK tools at "%_androidtools%" & Pause & Exit 5
:: Modify it to work under your environment//modify this directory to point to your NDK root directory
Set _NDKROOT=E:\ANDROID\ANDROID-NDK-R8
If not exist "%_ndkroot%" echo couldn ' t find ndk at "%_ndkroot%" & Pause & Exit 6






Double-click Run Create-android-project.bat This file, you will be prompted to enter the package name, then the project name, the last SDK version
Created successfully, you will see your new project in the root directory of Cocos2d-x
Directory will contain classes, proj.android, resources three directories classes for C + + source directory, proj.android Android project, resources for the resource directory
Add a word to the proj.android/jni/application.mk of the corresponding project
App_cflags + =-wno-error=format-security


Compile the project, open the Cygwin, go to the Android root you just created, run the build_native.sh file (input./build_native.sh), this is a compilation process until the end of compilation
Import Android project to eclipse








Problem Description:
After the build_native.sh runs successfully, this problem occurs after importing the project into eclipse, prompting that the following files cannot be found:
Import org.cocos2dx.lib.Cocos2dxActivity;
Solution:
1. Simply copy the folder under the Cocos2dx/platform/android/java/src folder in the root directory of the Cocos2d-x engine to the project's SRC package.
2. You can also import Cocos2dx/platform/android/java this project generates a jar file to add to the project's Libs folder.
Both of these methods will be copied to the APK when it is eventually generated.

Cocos2d-x Environment Building for Eclipse

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.