NDK Build Usage (NDK build) (RPM)

Source: Internet
Author: User

1, the use of Ndk-build

Android NDKR4 introduces a new, small shell script Ndk-build to simplify source code compilation.

The file is located in the NDK root directory, and after entering your project root directory or subdirectory, you can use it at the command line. For example:

CD $PROJECT

$NDK/ndk-build

The NDK points to the installation directory of your NDK, project points to your Android engineering directory. We recommend that you add the directory where you are ndk-build to the PATH environment variable or set alias.

2. Ndk-build Options

All options for Ndk-build are passed directly to GNU make, which runs the NDK's compilation script. Several common invocation methods are as follows:

Ndk-build compiling

Ndk-build Clean out binaries

Ndk-build Ndk_debug=1 compiled as a debug version of a binary file

Ndk-build Ndk_debug=0 compiled to release version

Ndk-build V=1 executes the ndk-build and prints out the detailed compilation commands it executes.

Ndk-build-b forcing recompilation

Combination of Ndk-build-b V=1-b and V=1

Ndk-build ndk_log=1 Print out the internal NDK log information (for debugging NDK itself)

Ndk-build ndk_app_application_mk=< file path > Find application.mk file using the path specified here

Ndk-build-c <project path > CD into <project path, and then execute ndk-build.

3. Debug version Vs release version

In NDKr5, Ndk-build made some improvements, making it easier to switch between release and Debug. That is, through the Ndk_debug variable:

Ndk-build Ndk_debug=1 compiled shared library with debug information, debug version

Ndk-build Ndk_debug=0 compiled shared library without debug information, is release version

If Ndk_debug is not specified, it is fetched from androidmanifest.xml (see if the <application> element has android:debuggable= "true").

Note : If your SDK is SDKR8 or higher, you do not need to modify androidmanifest.xml at all. Because if you want to compile the DEBUG version of the installation package (either under the command line or with ADT), the SDK tool will automatically select the shared library that was compiled with Ndk_debug=1. The NDK-compiled debug and release versions of object files are stored in different directories (for example, Obj/local/<abi>/objs and Obj/local/<abi>/objs-debug). The switch between release and Debug is avoided, and all files are recompiled.

4, ndk-build conditions of use

In general, you must install the GNU make 3.81 version of make to properly use the Ndk-build and NDK.

5, the essence of Ndk-build

Ndk-build is actually a package for GNU make, which is designed to invoke the correct NDK compilation script, which is equivalent to the make-f $NDK/build/core/build-local.mk [parameters]

NDK Build Usage (NDK build) (RPM)

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.