Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

add prebuilt jar to AOSP

I am trying to add a prebuilt jar to Android when I compile AOSP. The name of the jar is "nxpnfclib.jar" and I put it to AOSP/prebuilts/misc/common/nxp. I also write a 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 whole AOSP, some errors occur:

Warning: class [com/nxp/nfclib/ntag/╦К.class] unexpectedly contains class [com.nxp.nfclib.ntag.ˊ] Warning: there were 30 classes in incorrectly named files. You should make sure all file names correspond to their class names. The directory hierarchies must correspond to the package hierarchies. If you don't mind the mentioned classes not being written out, you could try your luck using the '-ignorewarnings' option. Error: Please correct the above warnings first. make: *** [out/target/common/obj/APPS/Settings_intermediates/proguard.classes.jar] Error 1

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

Is there some other way to add the jar?

like image 915
Bing Avatar asked Apr 20 '16 13:04

Bing


1 Answers

Create one more directory libs into src and place the jar file into it. Then add these few more lines to Android.mk file

LOCAL_STATIC_JAVA_LIBRARIES += nxpnfclib
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:=nxpnfclib:src/libs/nxpnfclib.jar
include $(BUILD_MULTI_PREBUILT)
like image 139
Shailendra Yadav Avatar answered Nov 02 '22 05:11

Shailendra Yadav