我正在尝试编译在cocos2d-x上开发的Android native 应用程序。当我尝试调试我的应用程序时,出现以下错误。

Android NDK: jni/Android.mk: Cannot find module with tag 'CocosDenshion/android' in import path
Android NDK: Are you sure your NDK_MODULE_PATH variable is properly defined ?
Android NDK: The following directories were searched:

我的android.mk文件中包含以下几行
$(Call import-add-path, $(LOCAL_PATH)/../../../CocosDenshion/android)

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static

include $(BUILD_SHARED_LIBRARY)

$(call import-module,CocosDenshion/android)
$(call import-module,cocos2dx)

在我的build_native.sh中,NDK_MODULE_PATH定义为
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"

谁能帮我解决这个问题。

最佳答案

我前段时间有同样的问题
当我在eclipse中定义cocos2dx变量时,在构建时没有看到它,因此发生了错误ndk模块路径

然后我尝试设置没有变量的硬编码模块路径,并且它有效
所以我的ndk模块路径看起来像这样,也在eclipse中定义了ndk_root

if [[ "$buildexternalsfromsource" ]]; then
echo "Building external dependencies from source"
"$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \
    "NDK_MODULE_PATH=/home/myname/adt/cocos2dx:/home/myname/adt/cocos2dx/cocos2dx/platform/third_party/android/source"

这是我在Windows PC中的外观尝试一下

如果[[“$ buildexternalsfromsource”]];然后
回显“从源代码构建外部依赖项”
“$ NDK_ROOT”/ndk-build -C“$ APP_ANDROID_ROOT” $ *\
“NDK_MODULE_PATH =/cygdrive/c/Users/metin/Desktop/cocos2dx:/cygdrive/c/Users/metin/Desktop/cocos2dx/cocos2dx/platform/third_party/android/source”
别的
回显“使用预建的外部组件”
“$ NDK_ROOT”/ndk-build -C“$ APP_ANDROID_ROOT” $ *\
“NDK_MODULE_PATH =/cygdrive/c/Users/metin/Desktop/cocos2dx:/cygdrive/c/Users/metin/Desktop/cocos2dx/cocos2dx/platform/third_party/android/prebuilt”
科幻

这是我的Android.mk

LOCAL_WHOLE_STATIC_LIBRARIES:= cocos2dx_static cocosdenshion_static cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES + = Chipmunk_static

包括$(BUILD_SHARED_LIBRARY)

$(调用import-add-path,/cygdrive/c/Users/metin/Desktop/cocos2dx)
$(调用import-add-path,/cygdrive/c/Users/metin/Desktop/cocos2dx/cocos2dx/platform/third_party/android/prebuilt)

$(调用import-module,CocosDenshion/android)
$(调用import-module,cocos2dx)
$(调用import-module,external/chipmunk)
$(调用import-module,扩展名)

关于android - Cocos2dx应用程式中“cannot find module with tag ' CocosDenshion/android ' in import path”错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16163743/

10-10 04:27