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:
**** 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
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
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.
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?
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:
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.