我在创建Android预建共享库时遇到问题。为了找出问题所在,我遵循了Google的example,在android-8.1.0_r52树中的development / ndk / tests / prebuilt-library / jni中找到了此示例的源代码。
这是我配置ASOP的方式
然后在上面的jni文件夹中发出“ $ mm”
我得到的错误是(与我的其他项目相同)
ninja: error: 'out/target/product/bullhead/obj/SHARED_LIBRARIES/foo-prebuilt_intermediates/export_includes', needed by 'out/target/product/bullhead/obj/SHARED_LIBRARIES/foo-user_intermediates/import_includes', missing and no known rule to make it
当我为“ foo ”配置out / target / products / bullhead文件夹时,我什么也没得到。
我也尝试替换
包括$(PREBUILT_SHARED_LIBRARY)
与
包括$(BUILD_PREBUILT)
并得到相同的错误,但是“ obj”被替换为“ obj_arm”。
下面是树随附的库存Android.mk。
LOCAL_PATH := $(call my-dir)
# Define BUILD_FOO=1 to rebuild libfoo.so from scratch, then
# copy obj/local/armeabi/libfoo.so to jni/libfoo.so
#
ifneq ($(BUILD_FOO),)
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_SRC_FILES := foo/foo.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/foo
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
include $(BUILD_SHARED_LIBRARY)
else # not build libfoo.so, trying to use PREBUILT_SHARED_LIBRARY instead.
# Note: the module is named foo-prebuilt, but the library is libfool.so !
#
include $(CLEAR_VARS)
LOCAL_MODULE := foo-prebuilt
LOCAL_SRC_FILES := libfoo.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/foo
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := foo-user
LOCAL_SRC_FILES := foo-user.c
LOCAL_SHARED_LIBRARIES := foo-prebuilt
include $(BUILD_SHARED_LIBRARY)
endif
这是jni /目录结构
jni /
Android.mk
foo-user.c
libfoo.so
foo /
foo.c
foo.h