引入单个aar和多个jar
diff --git a/Android.mk b/Android.mk
index f6ff7f4..1dd55fe 100644
--- a/Android.mk
+++ b/Android.mk
@@ -2,6 +2,8 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_STATIC_JAVA_LIBRARIES := jzxing
+LOCAL_STATIC_JAVA_AAR_LIBRARIES:=azxing
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -16,4 +18,13 @@ LOCAL_SYSTEM_EXT_MODULE := true
LOCAL_SHARED_ANDROID_LIBRARIES := android-support-v7-appcompat
include $(BUILD_PACKAGE)
-
+include $(CLEAR_VARS)
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += jzxing:libs/core-3.3.2.jar \
+ libs/core-3.3.2.jar \
+ libs/core-3.3.2-javadoc.jar \
+ libs/core-3.3.2-sources.jar \
+ libs/zxing-android-embedded-3.6.0-sources.jar
+include $(BUILD_MULTI_PREBUILT)
+include $(CLEAR_VARS)
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES +=azxing:libs/zxing-android-embedded-3.6.0.aar
+include $(BUILD_MULTI_PREBUILT)
引入多个aar和多个jar
diff --git a/Android.mk b/Android.mk
index f6ff7f4..5fee482 100644
--- a/Android.mk
+++ b/Android.mk
@@ -2,6 +2,10 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
+LOCAL_STATIC_JAVA_LIBRARIES := jzxing
+LOCAL_STATIC_JAVA_AAR_LIBRARIES := azxing \
+ anfc
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, src)
@@ -14,6 +18,21 @@ LOCAL_PRIVATE_PLATFORM_APIS := true
#LOCAL_PRODUCT_MODULE := true
LOCAL_SYSTEM_EXT_MODULE := true
LOCAL_SHARED_ANDROID_LIBRARIES := android-support-v7-appcompat
+#LOCAL_STATIC_JAVA_LIBRARIES +=posPrinter
+LOCAL_MANIFEST_FILE := AndroidManifest.xml
include $(BUILD_PACKAGE)
+include $(CLEAR_VARS)
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += jzxing:libs/core-3.3.2.jar \
+ libs/core-3.3.2.jar \
+ libs/core-3.3.2-javadoc.jar \
+ libs/core-3.3.2-sources.jar \
+ libs/zxing-android-embedded-3.6.0-sources.jar \
+ libs/dkcloudid-uart-android-sdk-v1.0.0-beta-sources.jar
+include $(BUILD_MULTI_PREBUILT)
+include $(CLEAR_VARS)
+LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := azxing:libs/zxing-android-embedded-3.6.0.aar \
+ anfc:libs/dkcloudid-uart-android-sdk-v1.0.0-beta.aar
+include $(BUILD_MULTI_PREBUILT)
引入so 库
错误方式
++ include $(CLEAR_VARS)
++ LOCAL_MODULE := libserial_port
++ LOCAL_SRC_FILES := libserial_port:libs/arm64-v8a/libserial_port.so \
++ libs/armeabi-v7a/libserial_port.so
++ include $(PREBUILT_SHARED_LIBRARY)
正确方式
TARGET_OUT 指的是:system
#$(shell mkdir -p $(TARGET_OUT)/app/xxx/lib/)
$(shell cp -r $(LOCAL_PATH)/libs/arm64-v8a/* $(TARGET_OUT)/app/xxx/lib/)
TARGET_OUT_SYSTEM_EXT 指的是:system_ext
xxx 指App名称
arm 指32位
arm64 则代表64位
所以我们需要兼容下这两种情况
$(shell mkdir -p $(TARGET_OUT_SYSTEM_EXT)/app/xxx/lib/arm/)
$(shell mkdir -p $(TARGET_OUT_SYSTEM_EXT)/app/xxx/lib/arm64/)
$(shell cp -r $(LOCAL_PATH)/libs/arm64-v8a/* $(TARGET_OUT_SYSTEM_EXT)/app/xxx/lib/arm/)
$(shell cp -r $(LOCAL_PATH)/libs/arm64-v8a/* $(TARGET_OUT_SYSTEM_EXT)/app/xxx/lib/arm64/)