Add Ready Jar to AOSP

I am trying to add a ready-made jar to Android when I compile AOSP. The flag name is "nxpnfclib.jar" and I put it in AOSP / prebuilts / misc / common / nxp. I also write Android.mk:

LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_PREBUILT_JAVA_LIBRARIES := \ nxpnfclib$(COMMON_JAVA_PACKAGE_SUFFIX) LOCAL_MODULE_TAGS := optional include $(BUILD_HOST_PREBUILT) 

I want to use this jar in AOSP / packages / apps / Settings, so I add nxpnfclib to AOSP / packages / apps / Settings / Android.mk

 LOCAL_STATIC_JAVA_LIBRARIES := guava android-support-v4 jsr305 nxpnfclib 

However, when I compile the entire AOSP, some errors occur:

Warning: class [com / nxp / nfclib / ntag / ╩K.class] unexpectedly contains class [com.nxp.nfclib.ntag. '] Warning: there were 30 classes in incorrectly named files. You must ensure that all file names match their class names. Directory hierarchies must match package hierarchies. If you do not mind that the specified classes are not written out, you can try your luck using the '-ignorewarnings' option. Error. Follow the warnings above first. do: *** [Exit / target / general / object / APPS / Settings_intermediates / proguard.classes.jar] Error 1

How can I fix this error? This may come from proguard.

Is there any other way to add a jar?

+6
source share
1 answer

Create another libs directory in src and put the jar file in it. Then add some more lines to the Android.mk file

 include $(CLEAR_VARS) LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=nxpnfclib.jar:src/libs/nxpnfclib.jar include $(BUILD_MULTI_PREBUILT) 
0
source

All Articles