Чувак ... эта ошибка сбила меня с толку.
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
Загрузка библиотеки и ее объявление:
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 Функция:
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) {
/* ... */
}
Я побежал
ndk-build -B -C [проект] / jni
и я ничего не могу заставить работать. Любые предложения или опыт с этой проблемой? Строка вызова в logcat - это я просто пытаюсь вызвать функцию, кстати. Спасибо ... пожалуйста, будь моим героем: (