Android ReactNative java.lang.UnsatisfiedLinkError:可以找到要加载的DSO:libreactnativejni.so [英] Android ReactNative java.lang.UnsatisfiedLinkError:could find DSO to load: libreactnativejni.so

查看:437
本文介绍了Android ReactNative java.lang.UnsatisfiedLinkError:可以找到要加载的DSO:libreactnativejni.so的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试将ReactNative添加到我现有的Android应用程序中。我按照这个的说明进行操作链接。我可以添加它,但是一旦打开react本机活动,应用程序就会崩溃。我已启动服务器使用

I have been trying to add ReactNative to my existing android application. I followed the instructions from this link. I could add it but the app gets crashed once I open the react native activity. I have started server using

adb reverse tcp:8081 tcp:8081

并启动react-native使用

and started react-native using

react-native start

我得到了js文件正在加载的对话框。但最终以崩溃告终。以下是在logcat中打印的错误:

I get a dialogue that the js files are loading. But finally end up with a crash. Following is the error that is being printed in logcat:

java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so
    at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:213)
    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:178)
    at com.facebook.react.bridge.JSCJavaScriptExecutor.<clinit>(JSCJavaScriptExecutor.java:19)
    at com.facebook.react.ReactInstanceManager.onJSBundleLoadedFromServer(ReactInstanceManager.java:413)
    at com.facebook.react.ReactInstanceManager.createReactContextInBackground(ReactInstanceManager.java:236)

我完全迷失了,因为我无法弄清楚这个问题的原因。

I am completely lost as I am unable to figure out the cause for this issue.

提前致谢。

推荐答案

这是由以下原因造成的问题(开放2年) https://github.com/facebook/react-native/ issue / 2814

This is caused by the following issue (open for 2 years) https://github.com/facebook/react-native/issues/2814

来自问题:


React Native在Android上不提供64位版本的 libreactnativejni.so 本机库,这可能会导致64位设备上的兼容性问题。我试图将React Native与我正在开发的大型现有应用程序集成在一起。

React Native on Android doesn't provide a 64-bit version of the libreactnativejni.so native library, which can cause compatibility issues on 64-bit devices. I ran into this while attempting to integrate React Native with a large existing application I'm developing.

来自Facebook的反应:

Reaction from Facebook:


感谢报告!是的,我们不提供64位版本的本机代码,系统应该总是回落到32 -bit。

并且:

大多数Android项目都使用数字第三方库,任何包含本机64位代码的文件都会导致React Native失败。

以下SO答案在64位Android上使用32位jni库解释了回退到32位库以及您的事实不能混。因此,如果找到64位,则全部应为64位

The following SO answer Use 32-bit jni libraries on 64-bit android explains fallback to 32-bit libraries and the fact you cannot mix. So if 64-bit is found, all should be 64-bit

我建议阅读Github问题#2814。提出了多种修复方法,但这取决于您的情况有效。

I suggest reading along the Github issue #2814. There are multiple fixes proposed, but it depends on your situation what works.

发行人还写了一篇关于它的博客:在Android中混合32位和64位依赖关系

The issuer has also written a blog about it: Mixing 32- and 64-bit Dependencies in Android

希望这有帮助!

这篇关于Android ReactNative java.lang.UnsatisfiedLinkError:可以找到要加载的DSO:libreactnativejni.so的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆