NDK Configuration in Eclipse

Source: Internet
Author: User

first, about the NDK:
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 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).


Second, the implementation of the NDK instance:
for the development of the NDK under the Windows environment, if the NDK used was a prior version of R7, it was necessary to install Cygwin in order to use the NDK, so the builder needed to be configured for Eclipse was actually performing Cygwin, The ndk-build is then passed as a parameter. At the beginning of NDKr7, Google's Windows version of the NDK provides a ndk-build.cmd script so that it can be compiled directly from the script without the need to use Cygwin. Just add a builders to the Eclipseandroid project, and you'll have eclipse automatically compile the ndk.


This article is about implementation examples under NDK-R7.
here is the process of using NDK-R7 to configure auto-compiled builders under windows (actually, for Linux, you only need to modify Ndk-build.cmd to Ndk-build. )。
(1) Download the installation ndk-r7 first.
:Http://developer.android.com/sdk/ndk/index.html
after downloading, unzip can be used.
(2) Open Eclipse, create a new Android project (my name is TESTNDK), create a new JNI folder under the project directory TESTNDK, which is used to save the file code that the NDK needs to compile, and so on.
(3) Create and configure a builder:
(a) project->properties->builders->new, create a new builder.
(b) in the "Choose Configuration Type" dialog box that pops up, select "Program" and click "OK":
(c) in the "Edit Configuration" dialog box that pops up, configure the tab "Main".
Enter a name for the new builders in "name" (I'm named ndk_builder).
Enter the path to the Nkd-build.cmd in location .
(My is D:\AndroidDev\android-ndk-r7\ndk-build.cmd, according to the respective NDK path settings, you can also click "Browser File System ..." to select this path).
enter ${WORKSPACE_LOC:/TESTNDK} in "Working Diretcoty" (You can also click "Browse Workspace" to select the Testndk directory).
 
(d) In the Edit Configuration dialog box, configure the tab "Refresh".
tick "Refresh Resources upon completion",
tick "The entire workspace",
tick "recuresively include sub-folders".
 
(e) In the Edit Configuration dialog box, configure the tab "Build options".
tick "After a" and "clean",
tick "During manual builds",
tick "During Auto builds",
tick "Specify working set of relevant resources".
 
click on "Specify Resources ..."
tick the "JNI" directory of the TESTNDK project and click "Finish".
Click "OK" to complete the configuration.
OK, here, Eclipse will be able to automatically invoke the NDK to compile the code for C + + in the Jin directory.

NDK Configuration in Eclipse

Related Article

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.