LOCAL_PREBUILT_JNI_LIBS:
时间: 2023-08-31 16:12:39 浏览: 136
完美解决安卓jni项目会删除其他so文件的问题
LOCAL_PREBUILT_JNI_LIBS is a variable used in Android.mk files to specify pre-built JNI libraries that are needed by the project. JNI (Java Native Interface) is a programming framework that enables Java code to call and be called by native applications or libraries written in C or C++.
When building an Android app that uses native code, the NDK (Native Development Kit) is used to compile the C/C++ code into a native library that can be accessed by the Java code through JNI. However, sometimes it's necessary to include pre-built native libraries that were compiled outside of the Android build system.
In such cases, the LOCAL_PREBUILT_JNI_LIBS variable is used to specify the path to the pre-built libraries and their associated header files, if any. The variable is typically defined in the Android.mk file of the module that requires the pre-built libraries.
For example, to include a pre-built library named libfoo.so located in the /path/to/libfoo directory, the following lines would be added to the Android.mk file:
```
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_SRC_FILES := libfoo.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
include $(PREBUILT_SHARED_LIBRARY)
```
Here, the LOCAL_MODULE variable specifies the name of the module that will be built, LOCAL_SRC_FILES specifies the name of the pre-built library file, and LOCAL_EXPORT_C_INCLUDES specifies the path to any header files needed by the library.
The include $(PREBUILT_SHARED_LIBRARY) line tells the build system to include the pre-built library in the module being built.
阅读全文