compile/link prebuilt nonstatic java library failed?

Hi all,
Did you know how to use a prebuilt nonstatic java library in framework.
I compile a nonstatic java library first use

LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES := \
$(call all-subdir-java-files, ./src)

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := mylib
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_JAVA_LIBRARIES := core core-junit ext

include $(BUILD_JAVA_LIBRARY)

because it's nonstatic java library, so
under out/target/common/obj/JAVA_LIBRARIES/mylib_intermediates/javalib.jar
contain classes.dex.
I want to release mylib.jar binary, and framework.jar depends on it, so in
framework android.mk I add LOCAL_JAVA_LIBRARIES := mylib
and prebuilt mylib android.mk is like:


LOCAL_PATH := $(PREBUILT_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := mylib
LOCAL_MODULE_TAGS := optional eng
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
LOCAL_SRC_FILES :=
../../.././target/common/obj/JAVA_LIBRARIES/mylib_intermediates/javalib.jar
include $(BUILD_PREBUILT)

Now I meet a link error, framework can't find the package in mylib.jar
I read build/core/prebuilt.mk got some infos:

ifeq ($(LOCAL_IS_HOST_MODULE)$(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# for target java libraries, the LOCAL_BUILT_MODULE is in a
product-specific dir,
# while the deps should be in the common dir, so we make a copy in the
common dir.
# For nonstatic library, $(common_javalib_jar) is the dependency file,
# while $(common_classes_jar) is used to link.
common_classes_jar := $(call
intermediates-dir-for,JAVA_LIBRARIES,$(LOCAL_MODULE),,COMMON)/classes.jar
common_javalib_jar := $(dir $(common_classes_jar))javalib.jar

$(common_classes_jar) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
$(transform-prebuilt-to-target)

$(common_javalib_jar) : $(common_classes_jar) | $(ACP)
$(transform-prebuilt-to-target)

# make sure the classes.jar and javalib.jar are built before
$(LOCAL_BUILT_MODULE)
$(built_module) : $(common_javalib_jar)
endif # TARGET JAVA_LIBRARIES


it said that for nonstatic library, $(common_javalib_jar) is the dependency
file, while $(common_classes_jar) is used to link.
the issue is that nonstaitc java lib (javalib.jar) only have classes.dex,
but the prebuilt.mk just cp javalib.jar --> classes.jar then
classes.jar-->javalib.jar, the classes.jar == javalib.jar
it seems nonstatic java lib can't use include $(BUILD_PREBUILT) maybe it's
a bug in prebuilt. Can anybody help me about this, or answer me if android
build system support prebuilt nonstatic java lib and depended by other lib
like framework.jar? if support, what should I do? Thanks
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值