yctung / AndroidLibSVM

The well-known LibSVM on Android
BSD 3-Clause "New" or "Revised" License
111 stars 43 forks source link

cannot locate symbol "atof" referenced by "libjnilibsvm.so" #9

Open HardyChina opened 6 years ago

HardyChina commented 6 years ago

The problem happened when i change the “minSdkVersion” to 19. i use flushbonading Android pad to get data from our sensor,and i want use libsvm ,but the most flushbonading Android pad is still api 19.

yctung commented 6 years ago

Hi, how about building the source by yourself? I believe it can solve the problem. You can import the library project to your Android project and add dependence on it.

JasonChungLin commented 6 years ago

I also have the same problem. Running on a tablet (Acer A1-713 (android 4.4.2, API 19) ) //Android Studio 3.0.1 I trained on windows and generated a model. However, I would like to use model do predict on android. I import AAR library into my android project and add the app dependency.

This my code:

> import android.app.Activity;
> import android.os.Environment;
> import android.os.Bundle;
> 
> import umich.cse.yctung.androidlibsvm.LibSVM;

> public class MainActivity extends Activity {
>     String path = Environment.getExternalStorageDirectory().toString() + "/LIBSVMFile";
>     String model_name = path + "/Model2.txt";
>     String test_txt = path + "/testdata.txt";
>     String result_txt = path + "/result.txt";
>     LibSVM svm;

>  @Override
>     protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.activity_main);
>         svm = new LibSVM();
>         svm.predict(test_txt + model_name + result_txt);
>     }

This my gradle setting:

compileSdkVersion 26 defaultConfig { minSdkVersion 18 targetSdkVersion 26 versionCode 1 versionName "1.0"

This my issue:

E/AndroidRuntime: FATAL EXCEPTION: main Process: com.oit.testlibsvm, PID: 22742 java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "atof" referenced by "libjnilibsvm.so"... at java.lang.Runtime.loadLibrary(Runtime.java:371) at java.lang.System.loadLibrary(System.java:526) at umich.cse.yctung.androidlibsvm.LibSVM.(LibSVM.java:14) at com.oit.testlibsvm.MainActivity.onCreate(MainActivity.java:20) at android.app.Activity.performCreate(Activity.java:5264) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) at android.app.ActivityThread.access$800(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5292) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640) at dalvik.system.NativeStart.main(Native Method)

Saravana-G commented 6 years ago

Is there a solution for this problem. Even I'm encountering this crash. I'm running it on Samsung galaxy s6. Android version 6.0.1.

yctung commented 6 years ago

Will check it soon.