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

后端 未结 7 1420
青春惊慌失措
青春惊慌失措 2021-02-18 18:35

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.         


        
相关标签:
7条回答
  • 2021-02-18 18:43

    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)
    0 讨论(0)
  • 2021-02-18 18:44

    http://www.cocos2d-x.org/forums/6/topics/36474

    http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-android-cc-debugging

    The above links have detailed explanations on how to debug cocos2d-x project as native android application.

    0 讨论(0)
  • 2021-02-18 18:44

    You have to change this line in "build_native.sh"

    COCOS2DX_ROOT="$DIR/../.." 
    

    depending on the location of your android project based on cocos2d-x root. For example if your your android project path is : C:\cocos2d-x\Projects\ProjectName\proj.android then

    COCOS2DX_ROOT="$DIR/../../.." 
    

    (you have to go three steps back to get to the root of cocos2d-x)

    but if your project path is C:\cocos2d-x\ProjectName\proj.android then

    COCOS2DX_ROOT="$DIR/../../.." 
    

    (you have to go two steps back to get to the root of cocos2d-x)

    hope that helps

    0 讨论(0)
  • 2021-02-18 18:46

    You'll need to define your NDK_MODULE_PATH to the folder that contains "CocosDension/Android" folder.

    So for example if you define NDK_MODULE_PATH += /cygdrive/c/ndk_modules

    you will need to put your cocos dension here: /cygdrive/c/ndk_modules/CocosDension/Android/Android.mk

    Checkout this documentations:

    https://docs.google.com/document/d/127ZkklXDyknjKAIVAos-DWI9nZSB3uKmTI84lk1TJ9k/edit

    https://android.googlesource.com/platform/ndk/+/675fe49445e65ba44d91f4d85ed9b4d5b5ff6745/docs/IMPORT-MODULE.TXT

    0 讨论(0)
  • 2021-02-18 18:47

    I had the same issue. The problem is, that the NDK_MODULE_PATH is environment variable and Eclipse (4.2) doesn't let you define environment variables for debugging, only for build.

    So defining the NDK_MODULE_PATH variable system-wide is one solution. On Linux you can do it for example by editing your .profile and adding following:

    export NDK_MODULE_PATH="path/to/module"
    

    This solution is permanent, but not flexible.

    Another solution is starting eclipse from command line:

    $ export NDK_MODULE_PATH="path/to/module"
    $ eclipse
    

    This is more flexible and you can do it with simple script. If you change NDK_MODULE_PATH, you only need to restart Eclipse and not whole session.

    0 讨论(0)
  • 2021-02-18 18:54

    Even I had issues with Cocos2d-x android. You can try this and see if it helps.

    0 讨论(0)
提交回复
热议问题