0

I am working on an AOSP project where I need to use a .aar library with the res folder. I have added .aar reference in Android.mk file but getting below error while opening the app.

java.lang.NoSuchFieldError: No static field activity of type I in class Lcom/sample/voice/R$layout;

Android.mk

LOCAL_STATIC_JAVA_AAR_LIBRARIES += voice

LOCAL_AAPT_FLAGS += --extra-packages com.sample.voice

LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += voice:libs/voice.aar

Tried many solutions but don't know how to include the res file in the Android.mk. But this is working in android studio.

1 Answers1

0

Add below line in Android.mk to include the .aar/res folder in the .apk.

LOCAL_RESOURCE_DIR +=$(call intermediates-dir-for,JAVA_LIBRARIES,<voice>,,common)/aar/res

Here <voice> is your library name.