NDK Full Name: Native development Kit. 1. The NDK is a collection of tools. * The NDK provides a range of tools to help developers quickly develop C (or C + +) dynamic libraries and automatically package so and Java applications together as APK. These tools are great for developers. * The NDK integrates the cross compiler and provides the corresponding MK file isolation platform, CPU, API and other differences, developers only need to simply modify the Mk file ("which files need to compile", "compile feature requirements", etc.), you can create a so. * The NDK can automatically package so and Java applications together, greatly reducing the developer's packaging effort. 2. The NDK provides a stable, functionally limited API header file declaration. Google expressly declares that the API is stable and supports the currently published API in all subsequent releases. As seen from this version of the NDK, these APIs support a very limited number of features, including: C standard library (LIBC), Standard math Library (LIBM), compression library (LIBZ), log Library (Liblog).
1. The NDK is a collection of tools. the NDK provides a range of tools to help developers quickly develop C (or C + +) dynamic libraries and automatically package so and Java applications together as APK. These tools are great for developers. The NDK integrates the cross compiler and provides the corresponding MK file isolation CPU, platform, ABI and other differences, developers simply need to modify the Mk file (stating "which files need to compile", "compilation characteristics Requirements", etc.), you can create a so. The NDK can automatically package so with Java applications, greatly reducing the developer's packaging effort.
2. The NDK provides a stable, functionally limited API header file declaration. Google expressly declares that the API is stable and supports the currently published API in all subsequent releases. As seen from this version of the NDK, these APIs support a very limited number of features, including: C standard library (LIBC), Standard math Library (LIBM), compression library (LIBZ), log Library (Liblog).
Prior to this, the Android platform's third-party applications were developed by relying on Java-based Dalvik specially crafted virtual machines. The publication of the native SDK gives developers more direct access to Android system resources, writes programs in the traditional C or C + + language, and embeds native library files directly into the program envelope file (. apks).
First, tool preparation
1.eclipse ADT (not too much here)
2.NDK installation package (download http://developer.android.com/tools/sdk/ndk/index.html available on the website)but the path after the decompression , it is strongly recommended that you cannot include spaces . For example: C:\Program files\android-ndk-r9b\, this is not recommended. Why don't we suggest a space? Because we're going to execute the command on the console. There is a path insidespaces,when operating in the consoleGeneral will have a problem.
3.cygwin (compilation tool used to build. So library): http://www.cygwin.com/when installed, most of the default can be
Steps:
3.1 Double-click Setup-x86-64.exe, select Install from the Internet.
3.2 Fill in the installation address. As with the above, the path of the Red box section should not have spaces . Next.
3.3Local package Directory, without modification, go directly to the next step.
3.4 is up. Select the connection mode select connection type. Choose according to your network connection situation. The general choice is the first direct connection. And then next.
3.5 Select download site select Download site. You look at the selection, or add your own URL. I am the mirrors.163.com of choice. And then next.
3.6 Below is the Select Package page. is the page that selects the downloaded package.
here, we onlyneed to download three packages on the line: Make, Gcc-core, gcc-g++.
< Span style= "LETTER-SPACING:0.5PX; line-height:22.5px ">
Here are four operations.
① Click the View button to change the display mode to full.
② in Search, enter the name of the package we need to download.
③ find the corresponding package, click Skip once, there is a block or a fork block.
④ Repeat steps ② and ③ until all of the packages we need are selected.
above four steps done, on the next step.
Next is to select the relevant package, tick on the line, the next step. Then, download the required packages.
And then just keep on doing the next step.
After finish, click on the desktop shortcut to open the Command Line window.
Command:
Make-v and Gcc-v. If a string of messages appears, install OK.
two. Add NDK to the build configuration of Cygwin
This is a simple step. Go to your Cygwin installation directory, enter home/[your user name]/directory, there is a. build_profile file.
If you do not have this file, then: /cygwin installation directory/etc/skel inside, there are 3 files
. Bash_profile,. BASHRC and. Inputrc. These three files are Cygwin for all users, and then copy all three files to their "User directory", the /cygwin installation directory /home/ [your user name]
Open with Notepad. At the end of the file, add the following two lines of sentence and save: ( Note that the modification . Bash_profile)
ndk=f:/jni/env/android-ndk-r9b
Export NDK
Here's an explanation: ndk=f:/jni/env/android-ndk-r9b This is the directory your NDK unzipped ( Note: The backslash here is/, not \.) the backslash under Linux differs from Windows. That's why I'm not doing it. There is also a point, = can not add space behind! )
Note: After adding, if your Cygwin window is open, turn it off and turn it back on.
after opening, verify that the configuration is successful. Input
CD $NDK
If you enter your NDK directory, that means OK. This step is just for quick access to the directory to compile!
Here, the NDK and the Cygwin are all installed OK. Open Eclipse below to install the CDT.
This step is mainly for the convenience of access to the directory for compiling, not set or line.
three. Installing the CDT
CDT, which is the C + + edit plugin for eclipse. Because it's JNI, it's written in C + +, and it's good to install. If you don't want to pretend it's OK, you can write it in Notepad or Visual Studio. Even if you use a needle to carve out C's code, just write the right line.
Eclipse installs plug-ins the same way, Help->install New software.
Here is the input cdt:http://download.eclipse.org/tools/cdt/releases/kepler. Tick main, optional to see your own needs.
Then the next step, what agree agreement, what restart, all listen to him.
Restart after the new project, see if there is a C + + project. If available, install OK.
Reference: http://my.oschina.net/lifj/blog/176916
If you have any questions, please leave a message, reproduced the source.