I am porting my C/C++ code into an Android Game using the NDK, but I'm having trouble getting started.
I have downloaded the NDK-r5b from developer.android.com and I have installed Cygwin.
I am not even able to run the Hello-jni
program provided within the NDK samples.
When I run:
$ cd /cygdrive/c/android/android-ndk-r5b/samples/hello-jni
$ ndk-build
I get an ERROR: You are using a non-Cygwin compatible Make program
.
I tried installing GNUMake 3.81 but the problem persists.
I tried to run the HELLO-JNI
sample program in the NDK through Eclipse IDE. There is a force close on the Android AVD, and logcat was showing an exception as follows:
04-08 12:32:11.609: ERROR/AndroidRuntime(274): FATAL EXCEPTION: main
04-08 12:32:11.609: ERROR/AndroidRuntime(274):
java.lang.ExceptionInInitializerError
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.Class.newInstanceImpl(Native Method)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.Class.newInstance(Class.java:1429)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.Instrumentation.newActivity(Instrumentation.java:1021)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2577)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2679)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.os.Handler.dispatchMessage(Handler.java:99)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.os.Looper.loop(Looper.java:123)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
android.app.ActivityThread.main(ActivityThread.java:4627)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.reflect.Method.invokeNative(Native Method)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.reflect.Method.invoke(Method.java:521)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
dalvik.system.NativeStart.main(Native Method)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): Caused by:
java.lang.UnsatisfiedLinkError: Library hello-jni not found
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.Runtime.loadLibrary(Runtime.java:461)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
java.lang.System.loadLibrary(System.java:557)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): at
com.example.hellojni.HelloJni.<clinit>(HelloJni.java:67)
04-08 12:32:11.609: ERROR/AndroidRuntime(274): ... 15 more
04-08 12:32:11.678: WARN/ActivityManager(59): Force finishing
activity com.example.hellojni/.HelloJni
04-08 12:32:12.340: WARN/ActivityManager(59): Activity pause timeout
for HistoryRecord{44f925c8 com.example.hellojni/.HelloJni}
How can I make this work?