Android Development---Ndk-build does not automatically delete external libraries

Source: Internet
Author: User

1. JNI development requires an external library, which is placed in the Libs/armeabi directory at the end of the package, but Ndk-build updates the Libs/armeabi directory at each compile time, allowing the external library to be deleted. It is cumbersome to copy again every time you use it.
In Ndk-build Docs/prebuilts.html introduced the prebuilt, only a very simple few steps, you can ndk-build the external library
Automatically copy to the libs/armeabi/directory.
The steps are as follows:
A. Create a new directory under the JNI directory prebuilt (name arbitrary)
B. Place the external library libfoo_so.so libbar_so.so libfoo_a.a libbar_a.a in the new prebuilt directory
C. Create the ANDROID.MK in the prebuilt directory, as follows

Local_path: = $ (call My-dir)

Include $ (clear_vars)
Local_module: = Foo_so
Local_src_files: = libfoo-so.so
Include $ (prebuilt_shared_library)

Include $ (clear_vars)
Local_module: = Bar_so
Local_src_files: = libbar_so.so
Include $ (prebuilt_shared_library)


Include $ (clear_vars)
Local_module: = Foo_a
Local_src_files: = libfoo_a.a
Include $ (prebuilt_static_library)

Include $ (clear_vars)


Local_module: = bar_a
Local_src_files: = libbar_a.a


Include $ (prebuilt_static_library)

D. Finally add in the android.mk that need to use the external library
Local_shared_libraries: = Foo_so bar_so
Local_static_libraries: = Foo_a bar_a

Android Development---Ndk-build does not automatically delete external libraries

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.