I am new in ndk development in android.I have gone through the file system of ndk android. Here, explaining what i have done. 1) i have created a folder named "jni" then create 2 file named Android.mk and ndkfoo.c.
In Android.mk
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Here we give our module name and source file(s) LOCAL_MODULE := ndkfoo LOCAL_SRC_FILES := ndkfoo.c include $(BUILD_SHARED_LIBRARY) and in ndkfoo.c
#include <string.h> #include <jni.h> jstring Java_com_mindtherobot_samples_ndkfoo_NdkFooActivity_invokeNativeFunction(JNIEnv* env, jobject javaThis) { return (*env)->NewStringUTF(env, "Hello from native code!"); } then i have created NdkFooActivity class, in which i have written
// load the library - name matches jni/Android.mk static { System.loadLibrary("ndkfoo"); } But now when i build from cygwin in xp it creates .so file successfully then i run as android application. It gives me java.lang.UnsatisfiedLinkError in LOGCAT.
So, Please let me know where i am wrong.
Thanks in Advance,