It seems that this is a common problem, but it is not simple.
At first I searched on the network, and most documents could not build the environment perfectly.
You have set it up and recorded it here for reference at any time.
Environment WINXP + Android SDK + ndk r8b + cygwin 1.7.16-1 + cocos2d-1.0.1-x-0.12.0
1. Download Android SDK, ndk, cygwin
Http://dl.google.com/android/android-sdk_r20.0.1-windows.zip
Http://dl.google.com/android/ndk/android-ndk-r8b-windows.zip
Http://cygwin.com/setup.exe
2. The installation of the android SDK is not much said. There are many online apps.
Decompress the ndk to a directory without spaces. The following uses <ndk_dir> to indicate the ndk root directory after decompression.
Run setup.exe after you download cygwin. Components to be installed include:
Autoconf automake binutils gcc-core gcc-G ++ gcc4-core gcc4-g ++ gdb pcre-devel gawk make
You can search for and install cygwin at the top of the search page. <cyg_dir> is used to indicate the installation directory of cygwin.
3. After cygwin is installed, edit the <cyg_dir> \ home \ Administrator \. bash_profile file in windows.
Add the following content at the end of the file:
Ndk =/cygdrive/D/
Edit the create-android-project.bat file under the cocos2dx directory and modify the values of the following variables respectively
set _CYGBIN=C:\cygwin\binset _ANDROIDTOOLS=C:\android-sdk-windows\toolsset _NDKROOT=D:\Tools\Developer\Android\android-ndk-r8b
The above is the path used in my system. Students need to modify it based on their actual situation.
In this way, the environment is basically set up. Next we need to build a hello World project to verify whether the environment is available.
1. Run the create-android-project.bat file under the cocos2dx directory, enter the package name (for example: CN. Wey. Android), Project Name (for example: hello2dx), and the android SDK version used.
2. Run cygwin, enter the android directory under the newly created hello2dx directory in the Command window, and run the command
./build_native.sh
Compile the project until it ends normally.
3. Open eclipse, import the hello2dx project, compile and run it. You can see the classic cocos2dx Hello World interface.