Search code examples
androidandroid-ndkshared-librariescocos2d-x

Couldn't load game: findLibrary returned null: with cocos2d-x, no success despite many attempts?


I would like to try a simple project using Eclipse Mobile For Developers, the NDK, Android SDK, and Cocos2d-x.

I have correctly set the paths in: cocos2d-x/create-android-project.sh :

NDK_ROOT_LOCAL="/Users/Empon/android-ndk-r8e"
ANDROID_SDK_ROOT_LOCAL="/Users/Empon/android"

and in the settings in Eclipse ("NDK path" from the Properties).

I followed the topics in stackoverflow but I can't make my project work. One thing that seems strange compared to one topic: I don't have anything below "libs".

I am on Mac Lion 10.7.4 (I downloaded the 64bit version of Eclipse), I have got no error in the project, the only errors are when I run the app on android (4.0.4, Alcatel ot 997), with these errors (here is a summary from 2 attempts):

04-22 22:19:09.079: E/AndroidRuntime(14321): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load game: findLibrary returned null
04-22 22:19:09.079: E/AndroidRuntime(14321):    at java.lang.Runtime.loadLibrary(Runtime.java:365)
04-22 22:19:09.079: E/AndroidRuntime(14321):    at java.lang.System.loadLibrary(System.java:535)
04-22 22:19:09.079: E/AndroidRuntime(14321):    at com.first.cocos2dx.samplecocos2dxandroid.<clinit>(samplecocos2dxandroid.java:37)

Would you know anything about this?

Thanks a lot

(source: http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started )


EDIT:

I have this issue now, after exporting correctly NDK_ROOT : ndk-build: No such file or directory!

export NDK_ROOT=/Users/Empon/android-ndk-r8e/ndk-build: No such file or directory

But the file does exist in android-ndk-r8e... so, I double clicked on the file, it said define the NDK_PROJECT_PATH variable :

Empon$ /Users/Empon/android-ndk-r8e/ndk-build ; exit;
Android NDK: Could not find application project directory !    
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.    
/Users/Empon/android-ndk-r8e/build/core/build-local.mk:130: *** Android NDK: Aborting

I have tried this in the Terminal :

in the Terminal :

Empon$ export NDK_PROJECT_PATH=/Users/Empon/cocos2d-x/Monday3/ >> .bash_profile
Empon$ ./build_native.sh
NDK_ROOT = :/Users/Empon/android-ndk-r8e >> .bash_profile
export NDK_ROOT=/Users/Empon/android-ndk-r8e
COCOS2DX_ROOT = /Users/Empon/cocos2d-x/Monday3/proj.android/../..
APP_ROOT = /Users/Empon/cocos2d-x/Monday3/proj.android/..
APP_ANDROID_ROOT = /Users/Empon/cocos2d-x/Monday3/proj.android
Using prebuilt externals
./build_native.sh: line 89: :/Users/Empon/android-ndk-r8e >> .bash_profile
export NDK_ROOT=/Users/Empon/android-ndk-r8e/ndk-build: No such file or directory

or just change the path in Android.mk :

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

But still the same error with the Terminal... Any idea?


Solution

  • I think you didn't run the build_native.sh script