Build the Android NDK environment the Windows XP environment1 Some Downloads
① NDK r7:http://developer.android.com/sdk/ndk/index.html
② cygwin:http://www.cygwin.com/(1.7.11-1)
③ notepad++:http://notepad-plus-plus.org/download/v5.9.8.html
2 Cygwin installation
① perform the downloaded setup.exe. Click Next
② Select the installation method. Select Online installation. Suppose there is an off-the-shelf package. Option to install offline
③ Select the installation folder (Cygwin finally install folder)
④ Setting the local package staging path (download file storage folder)
⑤ Setting the network connection mode: Default direct connection
⑥ Select Download website. It's faster than http://mirrors.163.com.
⑦ Select the installation item.
By default, just select Devel (click Devel in the list, change the default to install), and the others are the defaults.
Note: binutils, gcc, Gcc-mingw, GDB, make and so on must be installed. See Refs-5
⑧ long wait until download is complete
Note: After downloading the package can be backed up, so that in the future can be directly offline installation, Fast Oh!
⑨ adds environment variables (System Properties, environment variables->path) to the system, such as my c:/cygwin/bin
3 Cygwin environmental validation
① executes Cygwin once (Cygwin.bat). To create some user environment files
② Detection
Version number of Cygwin: Cygcheck-c Cygwin
GCC version number: gcc--version
Version number of g++: g++--version
Make's version number: Make--version
GDB version number: GDB--version
The results are for example:
4 Configuring the NDK Path
① Extract the downloaded NDK to a folder
② Zai Cygwin home\< your username>\.bash_profile file last added: (Available notepad++ or ultraedit open)
ndk=/cygdrive/< your drive symbol >/<android NDK folder > Export NDK,
As my NDK=/CYGDRIVE/C/ANDROID/ANDROID-NDK-R7 export NDK
Note: The name "NDK" is a random one, and it is often used for a long time.
② Verification
Restart Cygwin, enter: CD $NDK
can enter the NDK corresponding folder description settings OK.
5 compiling project build. So file
Way One:
Compile under the Cygwin command line, as seen in the compile step. Three-step
① into Android Project working folder: CD $NDK
② into the Samples\hello-jni folder, the full path is C:\Android\android-ndk-r7\samples\hello-jni
③ Execution: $NDK/ndk-build.
Note: the command $NDK and/ndk-build are connected together with no spaces in between. The actual use is to enter the complete $ndk/ndk-build, do not just play ndk-build
Way two:
① in the. bash_profile file mentioned in step 4. Add to Jni=/cygdrive/jni folder
As I can for Jni=/cygdrive/c/android/android-ndk-r7/samples/hello-jni.
② CD $NDK
③ CD $jni
Two files are generated after normal compilation. For example, generate the appropriate. So file under the Project Libs/armeabi folder.
6 integration of C + + development environment in Eclipse (alternative)
Official website: http://www.eclipse.org/cdt/downloads.php
method One : Find the online installation address of the CDT plugin that matches your Eclipse version number on the official website and install it in Eclipse's install New software
mode two : Download the CDT installation package that matches your Eclipse version number on the official website, and after extracting the plugins and feagures copy, overwrite it with the Eclipse folder to
7 compiler for C + + configuration ...
8 Common errors and workarounds
① problem: Android ndk:host ' awk ' tool is outdated. For example, with the errors that I have seen, I have encountered problems
FIX: Delete awk execution file
References: http://sunting-bcwl.iteye.com/blog/1278574
http://maidini.blog.163.com/blog/static/3776270420111195059911/
② mistake will Cygwin Terminal as Cygwin.bat, this problem bothered me for nearly one hours Ah!
!
!
③ Other online issues http://bbs.chinavideo.org/viewthread.php?tid=10821&extra=page%3D2
Ubuntu11.10 environment (pending update ...)
Refs
1 http://blog.csdn.net/javatiger427/article/details/6115693
2 http://maidini.blog.163.com/blog/static/3776270420111194440211/
3 http://www.cnblogs.com/luxiaofeng54/archive/2011/08/13/2136982.html
4 http://www.metsky.com/archives/525.html
5 http://www.cnblogs.com/playing/archive/2011/07/14/2106727.html
Android NDK Environment built under Windows XP