开发板为RK3399
1、现有libdatabase_sqlcipher.so,放置在jniLibs/armeabi下面
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := libdatabase_sqlcipher.so
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/../lib //指定生成路径,默认到/system/lib64,由于是32位库,所以需重新指定
LOCAL_SRC_FILES := jniLibs/armeabi/$(LOCAL_MODULE)
#OVERRIDE_BUILD_MODULE_PATH := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)
include $(BUILD_PREBUILT)
另一种方式:但默认生成在lib64下面
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PREBUILT_LIBS :=libdatabase_sqlcipher:jniLibs/armeabi/libdatabase_sqlcipher.so
LOCAL_PREBUILT_LIBS +=libsqlcipher_android:jniLibs/armeabi/libsqlcipher_android.so
LOCAL_PREBUILT_LIBS +=libstlport_shared:jniLibs/armeabi/libstlport_shared.so
#LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/../lib
include $(BUILD_MULTI_PREBUILT)
2、现有sqlcipher.jar,放置在lib下面
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := sqlcipher.jar
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)//最终生成在/system/framework下面
LOCAL_SRC_FILES := libs/sqlcipher.jar
include $(BUILD_PREBUILT)
另一种写法:
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := sqlcipher:libs/sqlcipher.jar
include $(BUILD_MULTI_PREBUILT)
该方法生成在 一个临时目录,不能自动到/system/framework下面
3、APK编译,默认为64位,由于SO为32位,需指定,方式为:
#LOCAL_JAVA_LIBRARIES += org.apache.http.legacy
LOCAL_MULTILIB := 32
LOCAL_JNI_SHARED_LIBRARIES := libdatabase_sqlcipher libsqlcipher_android libstlport_shared
LOCAL_PRIVILEGED_MODULE := true
include $(BUILD_PACKAGE)
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))