I need to build an application with android.mk in aosp build tree. I have a custom .arr lib with me, Which resides in the following folder apps/libs/mylib.aar
Anyone can tell me how to include the aar in the android aosp build. I already tried the following methods described here Stackoverflow link for aosp build with .aar lib
Android.mk is looked like
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := sample
LOCAL_CERTIFICATE := platform
# SRC files
#=====================================================================
LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/aidl
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
$(call all-Iaidl-files-under, aidl)
# RES files
#=====================================================================
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_RESOURCE_DIR +=prebuilts/sdk/current/extras/constraint-layout/res
LOCAL_RESOURCE_DIR +=frameworks/support/v7/appcompat/res
LOCAL_RESOURCE_DIR +=frameworks/support/design/res
LOCAL_RESOURCE_DIR +=frameworks/support-v4/res
LOCAL_MANIFEST_FILE :=AndroidManifest.xml
LOCAL_USE_AAPT2 := true
LOCAL_PROGUARD_ENABLED := disabled
# static .aar files
#=====================================================================
LOCAL_STATIC_JAVA_AAR_LIBRARIES:= mylib.aar
#Adding aapt packages
#=====================================================================
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.appcompat
LOCAL_AAPT_FLAGS += --extra-packages android.support.v7.recyclerview
LOCAL_AAPT_FLAGS += --extra-packages android.support.annotations
LOCAL_AAPT_FLAGS += --extra-packages android.support.v4
LOCAL_AAPT_FLAGS += --extra-packages android.support.design
LOCAL_AAPT_FLAGS += --extra-packages com.sample.mylib
#Include Static libraries
#=====================================================================
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v7-appcompat
LOCAL_STATIC_JAVA_LIBRARIES := android-support-v7-recyclerview
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v7-gridlayout
LOCAL_STATIC_JAVA_LIBRARIES += android-support-annotations
LOCAL_STATIC_JAVA_LIBRARIES += android-support-design
LOCAL_STATIC_JAVA_LIBRARIES += gson
LOCAL_STATIC_JAVA_LIBRARIES += zxing
LOCAL_STATIC_JAVA_LIBRARIES += picasso
#Set out path
#=====================================================================
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_APPS)
#For build the application package
#=====================================================================
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := mylib:libs/mylib.aar
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += gson:libs/gson-2.8.1.jar
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += zxing:libs/core-3.3.3.jar
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += picasso:libs/picasso.jar
include $(BUILD_MULTI_PREBUILT)
include $(call all-makefiles-under,$(LOCAL_PATH))
I checked different approaches to build the same.