helloliu helloliu - 1 month ago 10
Java Question

No rule to make target `external/obpermissionjar/javalib/obpermissionjar-Pro20160628_1.0.9', needed by ..?

I want to add a 3rd lib in AOSP.First,I put the **.jar file in external/obpermission,and my Android.mk file are as follows:

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE:=obpermission
LOCAL_MODULE_TAGES:=optional
LOCAL_MODULE_CLASS:=JAVA_LIBRARIES
LOCAL_MODULE_PATH:=$(TARGET_OUT_JAVA_LIBRARIES)
LOCAL_SRC_FILES:=javalib/obpermissionjar-Pro20160628_1.0.9
include $(BUILD_PREBUILT)


But it builds failed with:

make: *** No rule to make target `external/obpermissionjar/javalib/obpermissionjar-Pro20160628_1.0.9', needed by `out/target/product/generic/obj/JAVA_LIBRARIES/obpermission_intermediates/obpermission'. Stop.

Answer

Change it to the following:

    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    LOCAL_MODULE:=obpermission
    LOCAL_MODULE_TAGES:=optional
    LOCAL_MODULE_CLASS:=JAVA_LIBRARIES
    LOCAL_MODULE_PATH:=$(TARGET_OUT_JAVA_LIBRARIES)
    LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
    LOCAL_SRC_FILES:=javalib/obpermissionjar-Pro20160628_1.0.9.jar
    include $(BUILD_PREBUILT)

You were missing the trailing .jar for the file path. It's also a good idea to include the LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX) but it's not required I don't believe.

Comments