Compilation error with SDK cocos2d-1.0.1-x-0.13.0-beta when adding Sequoyah plugin

Hi !

Up to now (I used cocos2d-x SDK 10), I used Sequoyah (plug-in added to Eclipse) in order to avoid to have to build my Android project with the Terminal using ./build_native.sh before launching it in Eclipse.

For my new project, I want to use SDK 13. I created an Android project with the create-android-project.sh script. I build with Terminal using ./build_native.sh and launch the HelloWorld project in Eclipse: everything works fine.

Now, I want to add Sequoyah to my project. As I did before with SDK 10, I simply select my project folder in Eclipse, right click => Android Tools => Add Native Support.

Then… I immediately get an error (red cross in Eclipse) in the /jni/Android.mk file at the following line:

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

Here is what I get in the console:

**** Build of configuration Default for project hb ****

ndk-build V=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:    
Android NDK:         
jni/Android.mk:19: *** Android NDK: Aborting.    .  Stop.

I think this error probably has something to do with the NDK_MODULE_PATH defined in build_native.sh there:

if [[ $buildexternalsfromsource ]]; then
    echo "Building external dependencies from source"
    $NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
        NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source
else
    echo "Using prebuilt externals"
    $NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
        NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt
fi

…but I don’t understand all what this code means

Or perhaps the problem is somewhere else…

Anybody can help me ?

Thanks guys

What you have to do is setting COCOS2DX_ROOT to correct value.

I get the same error. I use android_ndk_r7b. All of environment variable such as COCOS2DX_ROOT, NDK_ROOT, JAVA_HOME has been set. The tag android:debuggable is also true in AndoidManifest.xml
Here is content of my build_native.sh:

# set params
NDK_ROOT=/cygdrive/d/eclipse/android-ndk-r7b
COCOS2DX_ROOT=/cygdrive/d/eclipse/cocos2dx
GAME_ROOT=$COCOS2DX_ROOT/Demo7
GAME_ANDROID_ROOT=$GAME_ROOT/android
RESOURCE_ROOT=$GAME_ROOT/Resources

buildexternalsfromsource=

usage(){
cat << EOF
usage: $0 [options]

Build C/C++ native code using Android NDK

OPTIONS:
-s  Build externals from source
-h  this help
EOF
}

while getopts "s" OPTION; do
    case "$OPTION" in
        s)
            buildexternalsfromsource=1
            ;;
        h)
            usage
            exit 0
            ;;
    esac
done

# make sure assets is exist
if [ -d $GAME_ANDROID_ROOT/assets ]; then
rm -rf $GAME_ANDROID_ROOT/assets
fi

mkdir $GAME_ANDROID_ROOT/assets

# copy resources
for file in $RESOURCE_ROOT/*
do
if [ -d $file ]; then
cp -rf $file $GAME_ANDROID_ROOT/assets
fi

if [ -f $file ]; then
cp $file $GAME_ANDROID_ROOT/assets
fi
done

if [[ $buildexternalsfromsource ]]; then
echo "Building external dependencies from source"
$NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source
else
echo "Using prebuilt externals"
$NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt
fi

and here is content of my jniAndroid.mk:

LOCAL_PATH := $(call my-dir)
NDK_DEBUG = 1
include $(CLEAR_VARS)

LOCAL_MODULE := game_shared

LOCAL_MODULE_FILENAME := libgame

LOCAL_SRC_FILES := helloworld/main.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/HelloWorldScene.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes                   

LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static

include $(BUILD_SHARED_LIBRARY)

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

and here is content of my jni/Application.mk:

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti

Hi there
If you use this under Windows, you should edit only a create-android-project.bat file.
And you must say win specific path, etc. C:

When I use ./build_native.sh to compile It’s ok. But when I debug by ndk-gdb the problem was happen again.
It say: “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 ?”
I run both on Window 7 and Ubuntu 12.

Could anyone help me?

NDK_MODULE_PATH is defined in build_native.sh, i think you should export it if you want to use ndk-gdb.

I get the same problem with ndk-gdb .

jni/Android.mk:32: * Android NDK: Aborting. . Stop.
ERROR: The device does not support the application’s targetted CPU ABIs!
Device supports: armeabi
Package supports: 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 NDK:

I don’t understand any answer above. can someone explain it to me?

Dennis Ganda wrote:

I get the same problem with ndk-gdb .
>
jni/Android.mk:32: * Android NDK: Aborting. . Stop.
ERROR: The device does not support the application’s targetted CPU ABIs!
Device supports: armeabi
Package supports: 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 NDK:
>
I don’t understand any answer above. can someone explain it to me?

add to Android.mk in jni folder after “include $(BUILD_SHARED_LIBRARY)”string that:
$(call import-add-path,PATH_TO_YOUR_COCOS_FOLDER)
$(call import-add-path,PATH_TO_YOUR_COCOS_FOLDER/cocos2dx/platform/third_party/android/prebuilt)

In Eclipse this problem was solved (but that was Ubuntu OS) the following way:

  1. Open project properties, go to C++ build -> Environment. Add NDK_MODULE_PATH with value PATH_TO_YOUR_COCOS_FOLDER:PATH_TO_YOUR_COCOS_FOLDER/cocos2dx/platform/third_party/android/prebuilt. “:” is important. Rebuild.