Android NDK Environment built under Windows XP

Source: Internet
Author: User

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

Run the downloaded Setup.exe, click Next
Select the installation method. Choose to install online if you have an off-the-shelf offline package, you can choose to install offline
Select the installation directory (Cygwin final installation directory)
Setting the local package staging path (download file storage directory)
Setting the network connection mode: Default direct connection
Select the download site. This speed is faster http://mirrors.163.com
Select the installation item. In the default settings, simply select Devel (click Devel in the list to 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 later can be directly offline installation, Fast Oh!
Add environment variables (System Properties, environment variables->path) for the system, as my C:/cygwin/bin

3 Cygwin environmental validation

Run Cygwin once (Cygwin.bat) to create some user environment files
Detection
Version of Cygwin: Cygcheck-c Cygwin
GCC version: GCC--version
Version of g++: g++--version
Make version: Make--version
GDB version: GdB--version
Results such as:

4 Configuring the NDK Path

Extract the downloaded NDK to a directory
Zai Cygwin home\< Your user name >\.bash_profile file last added: (Available notepad++ or ultraedit open)
ndk=/cygdrive/< your drive symbol >/<android NDK directory > Export NDK,
As my NDK=/CYGDRIVE/C/ANDROID/ANDROID-NDK-R7 export NDK
Note: The name "NDK" is a casual, often used not too long
Verification
Restart Cygwin, input: cd $NDK
You can enter the NDK corresponding directory description settings OK.

5 compiling a project to generate a. so file

Way One:
Compile under the Cygwin command line, as shown in the three-step process


into Android Project working directory: CD $NDK
into the Samples\hello-jni directory, the full path is C:\Android\android-ndk-r7\samples\hello-jni
run: $NDK/ndk-build.
Note: the command $NDK and/ndk-build are connected together, there is no space in the middle, the actual use is to break into the full $ndk/ndk-build, do not just play ndk-build


Way two:
in the. bash_profile file that is mentioned in step 4, add the Jni=/cygdrive/jni directory
As I can for Jni=/cygdrive/c/android/android-ndk-r7/samples/hello-jni
CD $NDK
CD $jni

Generate two files after compiling compiled normally, for example, generate the corresponding. So file in the project Libs/armeabi directory.

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 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 on the official website, then unzip and overwrite the plugins and feagures with the Eclipse folder.

7 compiler for C + + configuration ... 8 Common errors and workarounds

problem: Android ndk:host ' awk ' tool is outdated, as shown in error, I encountered problems

FIX: Delete awk execution file
Reference: 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

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.