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

7

21

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.

Pushup answered 23/4, 2013 at 7:45 Comment(9)
github.com/cocos2d/cocos2d-x/blob/master/samples/Cpp/HelloCpp/… look at this file about how it define NDK_MODULE_PATH. Hope this'll be helpful.Adeno
No that does not help. Thank you for trying.Pushup
What do you define $NDK_ROOT?Adeno
E:\android-ndk-r8e which is my ndk path. I have defined it as environment variable in eclipsePushup
Try to add this to system environment? I guess.Adeno
Have done that too but did not helpPushup
@Pushup did u solved the problem ..i m facing same problem nowPentheus
No, unfortunately I haven't found a solution for this issue yet. Please post the answer if you solve this.Pushup
have you add path of cocosdension in to eclipse (adt)....?Corvin
O
7

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)
Occlude answered 28/4, 2013 at 10:14 Comment(9)
When i change my NDK_MODULE_PATH to if [[ "$buildexternalsfromsource" ]]; then echo "Building external dependencies from source" "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ "NDK_MODULE_PATH=E:/game/trunk/cocos2dx:E:/game/trunk/cocos2dx/platform/third_party/android/prebuilt" else echo "Using prebuilt externals" "$NDK_ROOT"/ndk-build -C "$APP_ANDROID_ROOT" $* \ "NDK_MODULE_PATH=E:/game/trunk/cocos2dx:E:/game/trunk/cocos2dx/platform/third_party/android/prebuilt" fi I get error when trying to build.Pushup
I get the following error when trying to build Description Resource Path Location Type make: *** Android NDK: Aborting. . Stop. Android.mk /game/jni line 245 C/C++ Problem. line 245 is $(call import-module,CocosDenshion/android)Pushup
seems like it cant find the path, maybe because its in windows format. ill check in my windows and post itOcclude
hi i edited my answer and posted my windows ndk module path. cygdrive comes before your partitionOcclude
Now I am back to sqare 1 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:Pushup
i added my android.mk too :) check if it helpsOcclude
That also did not help. :(Pushup
let us continue this discussion in chatOcclude
You have not given the answer for my question correctly and told me that you are getting the same error when trying to debug and that you have not solved this. So can you explain why the upvotes for a wrong answerPushup
B
2

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

Burkey answered 18/6, 2014 at 5:11 Comment(0)
I
1

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

Imprimis answered 2/5, 2013 at 7:35 Comment(1)
I am sorry that does not helpPushup
A
1

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.

Alburg answered 25/9, 2013 at 10:19 Comment(0)
G
1

Check

build_native.sh  > **COCOS2DX_ROOT="$DIR/../../.."**

ex)

Project Name : FirstExam

c:\cocos2d-x\FirstExam ==> **COCOS2DX_ROOT="$DIR/../.."**

c:\cocos2d-x\example\FirstExam ==> **COCOS2DX_ROOT="$DIR/../../.."**
Gothenburg answered 13/12, 2013 at 1:29 Comment(1)
@iCodez @Gothenburg I have specified COCOS2DX_ROOT="$DIR/../.."Pushup
P
1

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.

Pushup answered 13/12, 2013 at 5:51 Comment(0)
C
1

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

Consultation answered 14/1, 2014 at 11:1 Comment(1)
I am sure that the COCOS2DX_ROOT is correct. The build wouldn't compile even as android app. Even then I have rechecked and verified the same. Thank you for trying to help though.Pushup

© 2022 - 2024 — McMap. All rights reserved.