Crash when running the java.lang.UnsatisfiedLinkError application


There is an application that uses the native library. When running on android 5.0 (Asus ), everything works fine, but if you run on Android versions lower (4.0.3-Sony Xperia P and 4.4 MTS ), the application crashes, writes the following in the log:

java.lang.ExceptionInInitializerError
                                                                           at com.snostorm.rakdroid.MainActivity.onCreate(MainActivity.java:36)
                                                                           at android.app.Activity.performCreate(Activity.java:5008)
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2027)
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2088)
                                                                           at android.app.ActivityThread.access$600(ActivityThread.java:134)
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199)
                                                                           at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                           at android.os.Looper.loop(Looper.java:137)
                                                                           at android.app.ActivityThread.main(ActivityThread.java:4744)
                                                                           at java.lang.reflect.Method.invokeNative(Native Method)
                                                                           at java.lang.reflect.Method.invoke(Method.java:511)
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
                                                                           at dalvik.system.NativeStart.main(Native Method)
                                                                        Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]:  1486 cannot locate 'atof'...

                                                                           at java.lang.Runtime.loadLibrary(Runtime.java:370)
                                                                           at java.lang.System.loadLibrary(System.java:535)
                                                                           at com.snostorm.rakdroid.BotService.<clinit>(BotService.java:37)
                                                                           at com.snostorm.rakdroid.MainActivity.onCreate(MainActivity.java:36) 
                                                                           at android.app.Activity.performCreate(Activity.java:5008) 
                                                                           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 
                                                                           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2027) 
                                                                           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2088) 
                                                                           at android.app.ActivityThread.access$600(ActivityThread.java:134) 
                                                                           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1199) 
                                                                           at android.os.Handler.dispatchMessage(Handler.java:99) 
                                                                           at android.os.Looper.loop(Looper.java:137) 
                                                                           at android.app.ActivityThread.main(ActivityThread.java:4744) 
                                                                           at java.lang.reflect.Method.invokeNative(Native Method) 
                                                                           at java.lang.reflect.Method.invoke(Method.java:511) 
                                                                           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
                                                                           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
                                                                           at dalvik.system.NativeStart.main(Native Method)  

I tried to connect the stdc++ and stlport_shared libraries, but it didn't help.

UPD At the same time, if I remove the code that uses atof, I get

A/libc: Fatal signal 11 (SIGSEGV) at 0x00000020 (code=1), thread 12787 (ostorm.rakdroid)
Author: pavlofff, 2016-06-13

1 answers

As it turned out, the problem can be solved in 2 ways: either remove the code that uses atof, or use APP_PLATFORM := android-19.

SIGSEGV called this code:

int ret=0;
if((ret = pthread_kill(t, 0)) != 0){//<--тут
    pthread_create(&t, NULL, call_from_thread, NULL);
}

But on android 5.0+ everything works. Wonders...

 1
Author: Logotipo, 2016-06-15 08:04:23