.so的编译
进过测试,发现只有全编才能生成对应的so,编译了7.8种方法发现只有这种有效
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
...
// 指定模块运行所依赖的模块(模块安装时将会同步安装它所依赖的模块)
LOCAL_REQUIRED_MODULES := libMemFillTool \
//这样在编译的时候,NDK自动会把这个libMemFillTool打包进apk; 放在apk/lib/目录下
LOCAL_JNI_SHARED_LIBRARIES := libMemFillTool\
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE := libMemFillTool
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
//路径
LOCAL_SRC_FILES_arm :=libs/armeabi-v7a/libMemFillTool.so
LOCAL_MODULE_TARGET_ARCHS:= arm
LOCAL_MULTILIB := both
include $(BUILD_PREBUILT)
.jar的编译
这个使用的比较多,如下eg:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
...
LOCAL_STATIC_JAVA_LIBRARIES := gson \
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := gson:libs/gson-2.2.2.jar \
include $(BUILD_MULTI_PREBUILT)
aidl的编译
注意点:
- 编译的目录只能用单级目录
- 变量类型map只能in类型,不能用inout类型
- 不添加接口类eg:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
...
LOCAL_SRC_FILES := $(call all-java-files-under,src) \
src/com/galanz/aidlserver/serialport/IAidlSerialPort.aidl \
src/com/galanz/aidlserver/serialport/AttributeChangeCallBack.aidl \
src/com/galanz/aidlserver/serialport/InitFinishCallBack.aidl \
src/com/galanz/aidlserver/serialport/UpgradeCallBck.aidl \
include $(BUILD_PACKAGE)