Android Project compile and use C language dynamic library (so library)

Source: Internet
Author: User

Compiling so libraries

1, the new project, the establishment of the JNI directory for the placement of C language-related documents

2. Writing android.mk files

1 Local_path: = $ (call My-dir) 2 include $ (clear_vars) 3 local_ldlibs: =-llog 4 local_module    : = Psamlib  5    6                 7 8 9  include $ (build_shared_library)

3. Configure the Builders option

4, finished the above action can compile so library.

Using so library files

1, the new project, the establishment of the JNI folder for the C language related files, the above works in the. h file and compiled to get so file also into it.

2. Writing android.mk files

1 Local_path: = $ (call My-dir)2 include $ (clear_vars)3 local_ldlibs: =-llog4 local_module: = Psamdev5 local_src_files: = com_example_psam_api_psamdev.c6                 7 local_shared_libraries + = Libpsamlib8 9 Ten include $ (build_shared_library) One  A  -  - include $ (clear_vars) the local_module: = Libpsamlib - local_src_files: = libpsamlib.so -  -Include $ (prebuilt_shared_library)

3. Configure the Builders option

4. After completing the above action, you can use the function in so in the project.

Android Project compile and use C language dynamic library (so library)

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.