Ndk usage notes

Source: Internet
Author: User

MK File

Local_ldlibs: =
Connect to the existing static library of ndk. For example, if the C library function is used, you need to use-LC, which is in the user/lib directory.

----- Tips ----

Ndk usage tips

1. How to forcibly output the compilation command:
-------------------------------------------
Run the "ndk-build v = 1" command"

2. How to force re-compile all source files:
-------------------------------------------
Use GNU make's "-B" option, as in:

Ndk-Build-B

3. How to put your code in a folder other than $ Project/JNI:
-------------------------------------------
First, you can tell $ Project/JNI/Android. mk to include other android. mk

Second, define app_build_script in the application. mk file.
Point to the location of an android. mk file.

4. Compile without using the CD command to enter the project root directory:
-------------------------------------------
Run the ndk-Build-C command <project path>

5. Store your application. mk in a place other than $ Project/JNI:
---------------------------------------------------------
Commands supported after ndk r4
Ndk-build ndk_application_mk =/Your/path/application. mk

6. Reasonably Add the header file path to your module Declaration
---------------------------------------------------------
When you define several modules, compiling a module usually needs to contain the header file of another module, as shown in the following example:
$ Project/JNI/Foo/
Android. mk
Foo. h
Foo. c

$ Project/JNI/BAR/
Android. mk
Bar. c
 
This bar. C contains Foo. H. You need to add the foo path to JNI/BAR/Android. mk.
 
There is a method below:
Local_c_includes: = ../Foo, so that
 
The correct method is:
Local_c_includes: = $ (local_path)/../foo
 
We recommend that you use the relative path of $ (local_path ).

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.