Hi Tony, With these instruction I was able to build aar library using Android.mk, but how can we make aar library with Android.bp ?
Thanks, Vaibhav On Monday, June 4, 2018 at 7:31:32 PM UTC+5:30, Tony Guo wrote: > > Hi, > > Instead of *make **YourLibName out/target/common/obj/JAVA_LIBRARIES/* > *YourLibName_intermediates/**YourLibName.aar *Could you please try > > *make **YourLibName out/target/common/obj/JAVA_LIBRARIES/* > *YourLibName_intermediates/javalib**.aar* > > at least, it works on my AOSP build environment. > > Kind regards, > Tony > > On Friday, January 19, 2018 at 1:16:24 AM UTC+8, Sebotor wrote: >> >> Hello, >> I might be NOT understanding something... >> Did anyone tried this yet or was successful on building aar library >> within the AOSP, which can be reused by other apps in the tree? >> I had been trying to build my custom aar library in the AOSP build for >> several weeks, but it doesn't work. >> >> 1. With the "*make **YourLibName out/target/common/obj/JAVA_LIBRARIES/* >> *YourLibName_intermediates/**YourLibName.aar*", it gives me the >> following error >> Starting build with ninja >> ninja: Entering directory `.' >> ninja: error: unknown target 'out/target/common/obj/JAVA_LIBRARIES/ >> YourLibName_intermediates/YourLibName.aar' >> make: *** [ninja_wrapper] Error 1 >> >> 2. The only thing that works are the following commands >> - In the the Library directory: >> *mm* >> - In the main directory: >> *make **YourLibName* >> >> 3. After the build, the following files get produced >> >> in-out/target/poroduct/.../obj/JAVA_LIBRARIES/YourLibName_intermediates/ >> total 5668 >> rw-rw-r-- 1 sebotor sebotor 2428 Jan 18 07:45 javalib.jar >> in-out/target/common/obj/JAVA_LIBRARIES/YourLibName_intermediates/ >> total 6064 >> drwxrwxr-x 4 sebotor sebotor 4096 Jan 18 07:45 classes >> -rw-rw-r-- 1 sebotor sebotor 2428 Jan 18 07:45 classes-full-debug.jar >> -rw-rw-r-- 1 sebotor sebotor 2428 Jan 18 07:45 classes.jar >> -rw-rw-r-- 1 sebotor sebotor 2428 Jan 18 07:45 classes-jarjar.jar >> -rw-rw-r-- 1 sebotor sebotor 2428 Jan 18 07:45 javalib.jar >> -rw-rw-r-- 1 sebotor sebotor 3930 Jan 18 07:45 proguard_options >> -rw-rw-r-- 1 sebotor sebotor 385622 Jan 18 07:45 public_resources.xml >> drwxrwxr-x 4 sebotor sebotor 4096 Jan 18 07:45 src >> >> According to the google docs, even if the aar (or zip) is not created and >> the files are in those directories, I would hope to see something that >> resembles the documentation: >> https://developer.android.com/studio/projects/android-library.html >> >> Am I missing something or mis-understading? Please let me know. >> >> Thank you, >> >> Sebotor >> >> On Friday, November 17, 2017 at 5:28:40 AM UTC-8, kush singh wrote: >>> >>> 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.
