真的需要帮助。我被困在这里。谢谢你在这里的任何建议。
我正在使用 NDK 构建一个 so 库,然后在 java 中调用它。但是我只能在作为启动活动的 mainactivity 中调用它,如果我尝试在由 mainactivity 启动的另一个活动中调用它,它将失败。我在OnCreate
每个activity的方法中调用方法,代码很简单如下:
System.loadLibrary("svm-predict");
double dd = predictbattery("fsdfsdf", "sdfsdf", 0);
错误的堆栈是:
12-08 00:47:08.153: E/AndroidRuntime(13370): FATAL EXCEPTION: main
12-08 00:47:08.153: E/AndroidRuntime(13370): java.lang.UnsatisfiedLinkError: predictbattery
12-08 00:47:08.153: E/AndroidRuntime(13370): at com.dash.RunningLogActivity.predictbattery(Native Method)
12-08 00:47:08.153: E/AndroidRuntime(13370): at com.dash.RunningLogActivity.onCreate(RunningLogActivity.java:58)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.os.Handler.dispatchMessage(Handler.java:99)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.os.Looper.loop(Looper.java:123)
12-08 00:47:08.153: E/AndroidRuntime(13370): at android.app.ActivityThread.main(ActivityThread.java:3683)
12-08 00:47:08.153: E/AndroidRuntime(13370): at java.lang.reflect.Method.invokeNative(Native Method)
12-08 00:47:08.153: E/AndroidRuntime(13370): at java.lang.reflect.Method.invoke(Method.java:507)
12-08 00:47:08.153: E/AndroidRuntime(13370): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-08 00:47:08.153: E/AndroidRuntime(13370): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-08 00:47:08.153: E/AndroidRuntime(13370): at dalvik.system.NativeStart.main(Native Method)