android 4.4/5.1上使用aar的问题

【android 4.4/5.1上使用aar的问题】大鹏一日同风起,扶摇直上九万里。这篇文章主要讲述android 4.4/5.1上使用aar的问题相关的知识,希望能为你提供帮助。
在android6.0上可以使用LOCAL_STATIC_java_AAR_LIBRARIES。build脚本会把指定的aar解压缩到临时目录,并将class.jar和res添加到对应的变量。

LOCAL_STATIC_JAVA_AAR_LIBRARIES := $(strip $(LOCAL_STATIC_JAVA_AAR_LIBRARIES)) ifdef LOCAL_STATIC_JAVA_AAR_LIBRARIES my_full_libs_manifest_deps += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/classes.jar) my_full_libs_manifest_files += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/AndroidManifest.xml)LOCAL_RESOURCE_DIR += $(foreach lib, $(LOCAL_STATIC_JAVA_AAR_LIBRARIES),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/aar/res) endif

LOCAL_STATIC_JAVA_AAR_LIBRARIES在Android4.4不存在,但是只要参照上面的步骤就可以了。手动将aar解压缩后添加到你的工程,并使用下面类似的语句:
LOCAL_STATIC_JAVA_LIBRARIES += lib_android_recyclerviewLOCAL_AAPT_FLAGS += --extra-packages android.support.v7.recyclerview LOCAL_RESOURCE_DIR += $(addprefix $(LOCAL_PATH)/, android-recyclerview-v7/res)LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += lib_android_recyclerview:android-recyclerview-v7/classes.jar

 

    推荐阅读