"cannot find module with tag 'CocosDenshion/android' in import path" error in cocos2dx app

glo picture glo · Apr 23, 2013 · Viewed 9.6k times · Source

I am trying to compile Android native application developed on cocos2d-x. When i Try to debug my application i get the following error.

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:

I have the following lines in my android.mk file

$(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)

In my build_native.sh The NDK_MODULE_PATH is defined as

"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt"

Can anyone help me solve this issue.

Answer

raging met picture raging met · Apr 28, 2013

I was having the same problem a while ago when I define cocos2dx variable in eclipse it didn't see it when building so the error ndk module path occured

Then I tried setting the module path hard coded without variable and it worked so my ndk module path looks like this, also defined ndk_root in eclipse

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"

This is how it looks in my windows pc give it a try

if [[ "$buildexternalsfromsource" ]]; then
    echo "Building external dependencies from 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/source"
else
    echo "Using prebuilt externals"
    "$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"
fi

Here is my Android.mk

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static

include $(BUILD_SHARED_LIBRARY)

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

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