You need to add the following function to the library:
#include <jni.h> jint JNI_OnLoad( JavaVM* vm, void* reserved ) { JNIEnv* jEnv = NULL; if ( JNI_OK != ( *vm )->GetEnv( vm, (void**)&jEnv, JNI_VERSION_1_4 ) ){ return -1; } return JNI_VERSION_1_4;
}
updated: lack of JNI_OnLoad () is not a problem ...
You wrote in a comment that you have many global initiators - consider such global initializations in JNI_OnLoad ()
Signature:
JNIEXPORT void JNICALL Java_com_android_test_testLib_init (JNIEnv *, jclass, jint, jint); JNIEXPORT void JNICALL Java_com_android_test_testLib_uninit (JNIEnv *, jclass); JNIEXPORT void JNICALL Java_com_android_test_testLib_touch (JNIEnv *, jclass, jint, jint, jint, jint); JNIEXPORT void JNICALL Java_com_android_test_testLib_update (JNIEnv *, jclass);
source share