Reputation: 1319
I have a custom android system image, I'd like to build my aar project(lib1.aar) into our android source code. My app app1, app2 will use this lib1.aar as their dependencies. I used below Android.mk file to make it, but I got 'R cannot be resolved to a variable' error since my code imported it like calling string from resource file.
LOCAL_PACKAGE_NAME := lib1
LOCAL_CERTIFICATE := platform
LOCAL_PROGUARD_ENABLED := disabled
include $(BUILD_JAVA_LIBRARY)
My question is how to write Android.mk file to compile my lib1.aar as a system lib to let my app use?
Thanks in advance.
Upvotes: 0
Views: 625
Reputation: 645
You can include your .aar libs with these lines:
LOCAL_STATIC_JAVA_AAR_LIBRARIES:= <aar alias>
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := <aar alias>:libs/<lib file>.aar
include $(BUILD_MULTI_PREBUILT)
Please, be aware of your projects and lib's minSDKVersion.
Upvotes: 3