Pre-installation of third-party (dynamic and static) Android sdk library in the system, it is convenient to use undifferentiated module.
Android.mk
include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_PREBUILT_LIBS := lib/libAirFlyWfd.so LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) include $(BUILD_MULTI_PREBUILT)
After compiling the installation will create the following three files to copy
out\target\product\dolphin-fvd-p1\system\lib\libAirFlyWfd.so
out\target\product\dolphin-fvd-p1\obj\lib\libAirFlyWfd.so
out\target\product\dolphin-fvd-p1\obj\SHARED_LIBRARIES\libAirFlyReceiver_intermediates\export_includes
among them
OUT \ target \ Product \ Dolphin-fvd- P1 \ System \ lib \ libAirFlyWfd.so
is used to arm packaged on the board.
OUT \ target \ Product \ Dolphin-fvd- p1 \ obj \ lib \ libAirFlyWfd.so
be used for other modules compile time link called.
Just want to connect to other systems need to use the same library when added
LOCAL_SHARED_LIBRARIES := \
libAirFlyWfd \
----------------------------------- The following is the process of mining pits --------- ------------------
According to the information of the internet, there are two ways, but after the test can not be used properly on android4.4.2
method to use include $ ( BUILD_PREBUILT)
include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_MODULE := libAirFlyWfd LOCAL_MODULE_CLASS :=SHARED_LIBRARIES LOCAL_SRC_FILES := lib/libAirFlyWfd.so include $(BUILD_PREBUILT)
The final result of this method is as follows,
out\target\product\dolphin-fvd-p1\system\lib\libAirFlyWfd out\target\product\dolphin-fvd-p1\obj\lib\libAirFlyWfd out\target\product\dolphin-fvd-p1\obj\SHARED_LIBRARIES\libAirFlyReceiver_intermediates\export_includes
Packed into two files in the directory lib .so no suffix, this has led to other modules call libAirFlyWfd this library in waiting
out \ target \ product \ dolphin- fvd-p1 \ can not be found under obj \ lib \ directory libAirFlyWfd.so and error
make: *** No rule to make target 'out/target/product/dolphin-fvd-p1/obj/lib/libAirFlyWfd.so'
Meanwhile packaged on the board
OUT \ target \ Product \ Dolphin-FVD-P1 \ System \ lib \ libAirFlyWfd this document no method is identified as dynamic library
If changed
LOCAL_MODULE := libAirFlyWfd.so
After the installation is as follows
out\target\product\dolphin-fvd-p1\system\lib\libAirFlyWfd.so out\target\product\dolphin-fvd-p1\obj\lib\libAirFlyWfd.so out\target\product\dolphin-fvd-p1\obj\SHARED_LIBRARIES\libAirFlyReceiver.so_intermediates\export_includes
Library file name is ok, but
libAirFlyReceiver.so_intermediates directory name wrong, resulting in more .so can not find export_includes when calling other modules
make: *** No rule to make target 'out/target/product/dolphin-fvd-p1/obj/SHARED_LIBRARIES/libAirFlyWfd_intermediates/export_includes'
Method Two Use include $ (PREBUILT_SHARED_LIBRARY)
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE :=libAirFlyWfd.so LOCAL_SRC_FILES := lib/libAirFlyWfd.so include $(PREBUILT_SHARED_LIBRARY)
According to the above method does not perform any reaction Android.mk, no definition should android 4.4.2
include $ (PREBUILT_SHARED_LIBRARY) corresponding method of operation, is only supported this operation looks like after NDK r5, did not specifically tested.
The last reference
https://blog.csdn.net/lizhiguo0532/article/details/7219349
use include $ (BUILD_MULTI_PREBUILT) method was ok.
-------------------------------------------------- ----------
the above is mounted to a shared library system, accessible to all modules.
If only a single module, can be used directly in the corresponding Android.mk
LOCAL_LDFLAGS + = $ (LOCAL_PATH) /lib/libAirFlyWfd.so
to the path specified library.
And do not forget the library copy (PRODUCT_COPY_FILES) to the next / system / lib /, in order to burn it to the board, or rely on this library application can not start properly on the board.