Hello everyone!
Here I am introducing the original method of editing, I personally think it is also a more general method, whether it is now cocos2d-x 2.2 or cocos2d-x 3.0 version is the same
First, we will introduce the android compilation process:
Prepare a few items before compilation.
1. Build an android Development Environment
This tool has integrated the android development environment.
2. To compile ndk, we need to build an ndk compiling environment.
First go to download: Cygwin address: http://www.programarts.com/cfree_ch/doc/help/UsingCF/CompilerSupport/Cygwin/Cygwin1.htm
Next to download: ndk (Note: it is best to use the latest version) Address: https://developer.android.com/tools/sdk/ndk/index.html
Configure Cygwin:
Find the Cygwin installation path, find cygwinhomewin7.bash _ profile, find the file to open, and add:
NDK_ROOT =/cygdrive/E/android/android-ndk-r9c (this is your ndk file path)
Export NDK_ROOT
The content is as follows:
# Base-files version 3.9-3
# To pick up the latest recommended. bash_profile content,
# Look in/etc/defaults/etc/skel/. bash_profile
# Modifying/etc/skel/. bash_profile directly will prevent
# Setup from updating it.
# The copy in your home directory (~ /. Bash_profile) is yours, please
# Feel free to customise it to create a shell
# Environment to your liking. If you feel a change
# Wocould be benifitial to all, please feel free to send
# A patch to the cygwin mailing list.
#~ /. Bash_profile: executed by bash for login shells.
# Source the system wide bashrc if it exists
If [-e/etc/bash. bashrc]; then
Source/etc/bash. bashrc
Fi
# Source the users bashrc if it exists
If [-e $ {HOME}/. bashrc]; then
Source $ {HOME}/. bashrc
Fi
# Set PATH so it should des user's private bin if it exists
# If [-d $ {HOME}/bin]; then
# PATH =$ {HOME}/bin :$ {PATH}
# Fi
# Set MANPATH so it should des users 'private man if it exists
# If [-d $ {HOME}/man]; then
# MANPATH =$ {HOME}/man :$ {MANPATH}
# Fi
# Set INFOPATH so it has des users 'private info if it exists
# If [-d $ {HOME}/info]; then
# INFOPATH =$ {HOME}/info: $ {INFOPATH}
# Fi
NDK =/cygdrive/E/android/android-ndk-r9c
Export NDK
The cygwin and ndk configurations have been completed.
To test whether the configuration is successful, you can go to the: E: androidandroid-ndk-r9csampleshello-jni directory to compile the examples that come with this ndk
If this occurs, the compilation is successful! It indicates that the cygwin and ndk configurations have been set up.
3. Everything is ready, and we start to compile our cocos2d-x helloword
Open cygwin and enter/cocos2d-x-2.2.2/samples/Cpp/HelloCpp/proj. android Input
The compilation starts: