include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := share_add LOCAL_STATIC_LIBRARIES := static_add LOCAL_SRC_FILES := share.c include $(BUILD_SHARED_LIBRARY) 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 注意上面生成的libstatic_add.a必须跟Android.mk放在同一目录下,否则...
① 动态库配置 : include $(PREBUILT_SHARED_LIBRARY) ② 静态库配置 : include $(PREBUILT_STATIC_LIBRARY) 3 . 链接依赖库时配置不一致 : ① 动态库依赖配置 : LOCAL_SHARED_LIBRARIES ② 静态库依赖配置 : LOCAL_STATIC_LIBRARIES X . 完整代码示例 1 . build.gra...
还有BUILD_STATIC_LIBRARY,和BUILD_SHARED_LIBRARY类似,表示编译成静态库,静态库不会被拷贝到APK中。 PREBUILT_SHARED_LIBRARY(预编译) 指向一个编译脚本,用来指定一个预编译动态库.使用此变量时,不像BUILD_SHARED_LIBRARY和BUILD_STATIC_LIBRARY那样,LOCAL_SRC_FILES的值必须是只能有一个指向预编译动态库的路径,如fo...
# $(TARGET_ARCH_ABI)/ 表示将不同架构下的库文件存放到相应架构目录下LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libmy_blocks.a#LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libmy_blocks.so # 用于预构建静态库(后面可被连接)include $(PREBUILT_STATIC_LIBRARY)#用于预构建动态库(后面可被连接) # includ...
include$(BUILD_STATIC_LIBRARY) 这将会生成一个名为lib$(LOCAL_MODULE).a的目标文件。 PREBUILT_SHARED_LIBRARY 指向一个编译脚本,该脚本用来指定一个预先编译好的共享库。这时候变量LOCAL_SRC_FILES值的含义,就和在BUILD_SHARED_LIBRARY和BUILD_STATIC_LIBRARY里面的不同。前者要设置成一个指向预编译好的共享库文...
PREBUILT_SHARED_LIBRARY 把这个共享库声明为 “一个” 独立的模块。 指向一个build 脚本,用来指定一个预先编译好多动态库。 与BUILD_SHARED_LIBRARY and BUILD_STATIC_LIBRARY不同, 此时模块的LOCAL_SRC_FILES应该被指定为一个预先编译好的动态库,而非source file. LOCAL_PATH := $(call my-dir) ...
static_add.a 编译好的静态库 Android mk LOCAL_PATH:=$(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE:=static_addLOCAL_SRC_FILES:=libstatic_add.a include $(PREBUILT_STATIC_LIBRARY)include $(CLEAR_VARS)LOCAL_MODULE:=share_addLOCAL_STATIC_LIBRARIES:=static_addLOCAL_SHARED_LIBRARIES:=liblogLOCAL...
常见的有: BUILD_HOST_STATIC_LIBRARY BUILD_HOST_SHARED_LIBRARY BUILD_STATIC_LIBRARY BUILD_SHARED_LIBRARY BUILD_EXECUTABLE BUILD_HOST_EXECUTABLE BUILD_PACKAGE BUILD_PREBUILT BUILD_MULTI_PREBUILT BUILD_HOST_PREBUILT BUILD_JAVA_LIBRARY BUILD_STATIC_JAVA_LIBRARY BUILD_HOST_JAVA_LIBRARY 不同类型的模块的...
BUILD_STATIC_LIBRARY(native静态库) 完整示例 Shadowsocks.apk 对应如下: 代码语言:txt 复制 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := optional LOCAL_MODULE := Shadowsocks # 系统签名 LOCAL_CERTIFICATE := PRESIGNED ...
# include $(BUILD_STATIC_LIBRARY) Application.mk定义目标设备: # MPU架构 APP_ABI := arm64-v8a # 安卓版本 APP_PLATFORM := android-24 # 规则文件 APP_BUILD_SCRIPT := Android.mk 在test目录下,通过命令编译: ndk-build NDK_APPLICATION_MK=Application.mk NDK_PROJECT_PATH=. ...