Note that there are some explanatory texts on larger screens.

plurals
  1. POabout calling native method in android
    primarykey
    data
    text
    <p>Really need help. I am stuck here. Thank you for any suggestion here.</p> <p>I am using NDK to build a so library then call it in java. But I can only call it in the mainactivity which is the start up activity, if I try to call it in another activity which is initiated by the mainactivity, it will fail. I call the method in the <code>OnCreate</code> method of each activity, the code is very simple as following:</p> <pre><code>System.loadLibrary("svm-predict"); double dd = predictbattery("fsdfsdf", "sdfsdf", 0); </code></pre> <p>The stack for the error is:</p> <pre><code>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) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload