Man ... ce bug m'a fait tomber.JNI et Android ... UnsatisfiedLinkError
Logcat:
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): FATAL EXCEPTION: main
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): java.lang.IllegalStateException: Could not execute method of the activity
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.view.View$1.onClick(View.java:2072)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.view.View.performClick(View.java:2408)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.widget.CompoundButton.performClick(CompoundButton.java:99)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.view.View$PerformClick.run(View.java:8819)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.os.Handler.handleCallback(Handler.java:587)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.os.Handler.dispatchMessage(Handler.java:92)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.os.Looper.loop(Looper.java:123)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.app.ActivityThread.main(ActivityThread.java:4627)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at java.lang.reflect.Method.invoke(Method.java:521)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at dalvik.system.NativeStart.main(Native Method)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): Caused by: java.lang.reflect.InvocationTargetException
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at com.example.viewer.Viewer.denoiseSlice(Viewer.java:170)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at java.lang.reflect.Method.invokeNative(Native Method)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at java.lang.reflect.Method.invoke(Method.java:521)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at android.view.View$1.onClick(View.java:2067)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): ... 12 more
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): Caused by: java.lang.UnsatisfiedLinkError: RicianDenoise
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): at com.example.viewer.Viewer.RicianDenoise(Native Method)
01-29 22:25:00.293: ERROR/AndroidRuntime(27386): ... 16 more
Chargement de la bibliothèque et déclarant:
public native void RicianDenoise(int w, int h, int p,
short [] s_noised_slice, double [] d_noised_slice,
short [] s_denoised_slice, double [] d_denoised_slice);
static {
System.loadLibrary("denoise");
}
C Fonction:
void
Java_com_example_viewer_Viewer_RicianDenoise (JNIEnv *env, jclass cls, jint M,
jint N, jint P, jshort * s_noised_slice,
jdouble * d_noised_slice,
jshort * s_denoised_slice,
jdouble * d_denoised_slice) {
/* ... */
}
J'ai couru
ndk-build -B -C [projet]/jni
et je ne peux rien obtenir au travail. Des suggestions ou une expérience avec ce problème? La ligne d'invocation dans le logcat est juste en essayant d'appeler la fonction, btw. Merci ... s'il vous plaît mon héros :(
encore une fois, je ne sais pas comment je l'ai fait Malheureusement, la fonction ne fait qu'activer l'activité sans message d'erreur ... alors là, nous allons découvrir un autre bug:/ –