如何构建具有相同名称的共享和静态库?

时间:2015-03-11 06:28:58

标签: android android-ndk

我想构建具有相同名称的共享和静态库,但我有一个错误:

Android NDK: But this module was already defined by path/to/Android.mk

Android.mk:

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := j
LOCAL_SRC_FILES := j.c
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := j
LOCAL_SRC_FILES := j.c
include $(BUILD_STATIC_LIBRARY)

我想发布共享和静态库。

1 个答案:

答案 0 :(得分:0)

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE    := j_shared
LOCAL_MODULE_FILENAME := libj
LOCAL_SRC_FILES := j.c
include $(BUILD_SHARED_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE    := j
LOCAL_SRC_FILES := j.c
include $(BUILD_STATIC_LIBRARY)

请注意,明确设置lib前缀,但不应提供.so后缀。