Compilation of the Android JNI

Source: Internet
Author: User

JNI code is written, before compiling we have a very important part, is to write the Mk file, the Mk file is equivalent to the GCC compile-time makefile file, it is used to tell the compiler how to compile.

Here only the understanding and common knowledge points to record, want to see all the explanations about ANDROID.MK please visit android.mk.

    1. The order of execution of the Mk file is executed from the top down order.
    2. Basic syntax.
      $ () reference method or variable
      : = Assignment Symbol
      + = Stitching Assignment value
      Include introduces (invokes) a code snippet, such as include $ (build_xxxxx), which is equivalent to taking the implementation of the Build_xxxxx method, which is executed when the compiler reads this line.
    3. The Mk file is basically local_path: = $ (call My-dir) include $ (clear_vars), ending with include $ (build_xxxxx)
    4. Common reserved variable parsing (basic all starts with Local_)
      Local_path: Specifies the location of the current file, which is basically assigned a value of $ (call My-dir)
      Local_src_files: Specify the source files to be compiled, multiple files are separated by spaces or using + = stitching to assign values
      Local_module: Specifies a MODULE name that must be unique and cannot have spaces
      Local_module_filename: Specifies the file name of the generated MODULE, which, by default, is generated by lib<local_module>. A or. so file
      Local_static_libraries: referenced static library (. a)
      Local_shared_libraries: Referenced dynamic library (. So)
      Local_ldflags: Specify Link Flags
    5. Common system methods
      Clear_vars: Clears all preset values
      Build_shared_library: Compiling a dynamic library (. So)
      Build_static_library: Compiling a static library (. a)
    6. Compile
      CD to the directory where the. mk file is located, execute the ndk-build command in the NDK package

Compilation of the Android JNI

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.