2015-06-10 51 views
0

我想將模塊導入到我的項目中。Android:加載預構建庫 - 循環依賴項丟失

Android.mk模塊:

LOCAL_PATH := $(call my-dir) 

include $(CEAR_VARS) 
LOCAL_MODULE := fromhere1 
LOCAL_MODULE_FILENAME := fromhere1 
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfromhere.so 
include $(PREBUILT_SHARED_LIBRARY) 

libfromhere.so是建立在我的項目NDK,建立

Android.mk:

LOCAL_PATH := $(call my-dir) 

include $(CLEAR_VARS) 


LOCAL_MODULE := native 
LOCAL_MODULE_FILENAME := libnative 
LOCAL_SRC_FILES := native.c 
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/ 
LOCAL_SHARED_LIBRARIES := fromhere1 
include $(BUILD_SHARED_LIBRARY) 


$(call import-module,module) 

當我運行NDK建造,我得到錯誤

[arm64-v8a] Compile  : native <= native.c 
make: Circular /home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so <- /home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so dependency dropped. 
[arm64-v8a] SharedLibrary : libnative.so 
aarch64-linux-android-g++: error: /home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so: No such file or directory 
make: *** [/home/raghuram/DS-5-Workspace/helloworld/obj/local/arm64-v8a/libnative.so] Error 1. 

我不明白爲什麼會出現這種循環依賴。 我遵循正確的語法。

回答

0

我的錯誤是LOCAL_MODULE_FILENAME的值。它必須是libherehere1而不是fromhere1。ndk只是把.so後綴放在給定的名字上,但它不會放入lib前綴。 總是最好讓自己給名字而不是讓ndk爲你命名。

但我不明白爲什麼會出現循環依賴。

1

包括$(PREBUILT_SHARED_LIBRARY)後,必須清除變量可能是你再次提前創建另一個庫......這些東西解決了我的問題:)

LOCAL_PATH := $(call my-dir) 

include $(CEAR_VARS) 
LOCAL_MODULE := fromhere1 
LOCAL_MODULE_FILENAME := fromhere1 
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfromhere.so 
include $(PREBUILT_SHARED_LIBRARY) 
include $(CEAR_VARS) 

LOCAL_MODULE := fromhere2 
LOCAL_MODULE_FILENAME := fromhere2 
LOCAL_SRC_FILES := $(TARGET_ARCH_ABI)/libfromhere2.so 
include $(PREBUILT_SHARED_LIBRARY) 
include $(CEAR_VARS)