0

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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for replying, I want to build my source code with Android image source code. not the aar one which packed by android studio.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.