Reputation: 3456
This might be a silly question but I'm struggling with it. I've seen some post about it on SO but I still can't solve the error.
I am facing the kinda famous unsastified link error.
My code is as follow.
The native.cxx:
extern "C" {
JNIEXPORT jlong JNICALL Java_com_example_VTKNative_JavaVTKLib_init(JNIEnv * env, jobject obj, jint width, jint height);
JNIEXPORT void JNICALL Java_com_example_VTKNative_JavaVTKLib_render(JNIEnv * env, jobject obj, jlong renWinP);
JNIEXPORT void JNICALL Java_com_example_VTKNative_JavaVTKLib_onKeyEvent(JNIEnv * env, jobject obj, jlong udp,
jboolean down, jint keyCode, jint metaState, jint repeatCount
);
JNIEXPORT void JNICALL Java_com_example_VTKNative_JavaVTKLib_onMotionEvent(JNIEnv * env, jobject obj, jlong udp,
jint action,
jint eventPointer,
jint numPtrs,
jfloatArray xPos, jfloatArray yPos,
jintArray ids, jint metaState);
};
struct userData
{
vtkRenderWindow *RenderWindow;
vtkRenderer *Renderer;
vtkAndroidRenderWindowInteractor *Interactor;
};
/*
* Here is where you would setup your pipeline and other normal VTK logic
*/
JNIEXPORT jlong JNICALL Java_com_example_VTKNativeJavaVTKLib_init(JNIEnv * env, jobject obj, jint width, jint height)
{
....
}
And the error I get is:
06-30 00:02:50.468: E/AndroidRuntime(14916): FATAL EXCEPTION: GLThread 960
06-30 00:02:50.468: E/AndroidRuntime(14916): Process: com.example.vtknative, PID: 14916
06-30 00:02:50.468: E/AndroidRuntime(14916): java.lang.UnsatisfiedLinkError: Native method not found: com.example.vtknative.JavaVTKLib.init:(II)J
06-30 00:02:50.468: E/AndroidRuntime(14916): at com.example.vtknative.JavaVTKLib.init(Native Method)
Hope it's not something crazy simple that I've just missed.
Thanks in advance.
Upvotes: 0
Views: 127
Reputation: 14473
You should rename your C++ function Java_com_example_VTKNativeJavaVTKLib_init
to Java_com_example_vtknative_JavaVTKLib_init
so it matches your Java declaration (com.example.vtknative.JavaVTKLib.init).
Upvotes: 3