To build the AAR file from the AOSP build, you need to make the Android.mk 
file for the that lib like below:-


LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SDK_VERSION := current
LOCAL_MODULE_TAGS := optional

*LOCAL_MODULE := YourLibName*

LOCAL_STATIC_JAVA_LIBRARIES :=android-common \
    android-support-v4 \
    android-support-design \
    android-support-v7-appcompat \
    android-support-design-res \
    android-support-v7-cardview


LOCAL_STATIC_JAVA_AAR_LIBRARIES:= name_of_any_aar_lib_your_using_your_lib

LOCAL_SRC_FILES := $(call all-java-files-under, java)

res_dirs := res \

LOCAL_RESOURCE_DIR := $(addprefix $(LOCAL_PATH)/, $(res_dirs)) \
    prebuilts/sdk/current/support/v7/cardview/res \
    prebuilts/sdk/current/support/v7/appcompat/res \
    prebuilts/sdk/current/support/design/res \

LOCAL_AAPT_FLAGS := \
    --auto-add-overlay \
    --extra-packages android.support.v7.cardview \
    --extra-packages android.support.v7.appcompat \
    --extra-packages android.support.design \
    --extra-packages package_name_of_any_aar_lib_your_using_your_lib


LOCAL_JACK_ENABLED := disabled 
LOCAL_PROGUARD_ENABLED := disabled 

*include $(BUILD_STATIC_JAVA_LIBRARY)*
##################################################
include $(CLEAR_VARS)

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := prebuild_libs_if_any


include $(BUILD_MULTI_PREBUILT)

include $(call all-makefiles-under,$(LOCAL_PATH))

you need to use *include $(BUILD_STATIC_JAVA_LIBRARY)* instead of *include 
$(BUILD_STATIC_AAR_LIBRARY) *it worked for me
and save this make file with name Android.mk in you module, then to build 
use below command 

*make **YourLibName out/target/common/obj/JAVA_LIBRARIES/*
> *YourLibName_intermediates/**YourLibName.aar*
>



On Monday, September 4, 2017 at 8:27:47 PM UTC+5:30, Ankit Bhargava wrote:
>
> Do you able to build AAR package using AOSP build? is it possible to do so?
>
> On Thursday, March 31, 2016 at 4:48:14 PM UTC+2, adhiti wrote:
>>
>> Need information on building AAR package using AOSP build. What are the 
>> changes required in Android.mk to build AAR package?
>>
>> For Ex: for static JAR we have include $(BUILD_STATIC_AAR_LIBRARY)
>>  to build static JAR.
>>
>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to