java.lang.UnsatisfiedLinkError:dlopen失败:找不到符号" srand"由" xx.so"引用

时间:2016-10-11 01:05:41

标签: java android android-ndk

我是NDK开发的新手。我已经使用NDK生成TreeSet<Product>个文件,它在Android 5.0或更高版本上运行良好,但在Android 4.4或之前版本崩溃。

记录是:

  

java.lang.UnsatisfiedLinkError:dlopen失败:找不到符号&#34; srand&#34;引用的是&#34; xx.so&#34; ...                                                          在java.lang.Runtime.loadLibrary(Runtime.java:362)                                                          在java.lang.System.loadLibrary(System.java:525)                                                          在com.uniquestudio.lowpoly.LowPoly。(LowPoly.java:14)                                                          在com.uniquestudio.lowpolyandroid.MainActivity.onCreate(MainActivity.java:22)                                                          在android.app.Activity.performCreate(Activity.java:5372)                                                          在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1104)                                                          在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2257)                                                          在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2349)                                                          在android.app.ActivityThread.access $ 700(ActivityThread.java:159)                                                          在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1316)                                                          在android.os.Handler.dispatchMessage(Handler.java:99)                                                          在android.os.Looper.loop(Looper.java:137)                                                          在android.app.ActivityThread.main(ActivityThread.java:5419)                                                          at java.lang.reflect.Method.invokeNative(Native Method)                                                          在java.lang.reflect.Method.invoke(Method.java:525)                                                          在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1187)                                                          在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)                                                          在dalvik.system.NativeStart.main(本地方法)

1 个答案:

答案 0 :(得分:1)

正如Dan在评论中指出的那样,你的问题肯定来自针对android api级别&gt; = 21的编译。

要解决您的问题,您可以在与APK的 minSdkVersion 相同的平台上编译代码。

你是如何使用NDK的?如果您使用的是 ndk-build ,请在 Android.mk 文件旁边添加 Application.mk 文件,内容为{{1 (其中14是你的minSdkVersion)。