请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

Android混合开发问题

图片描述

2020-04-22 11:59:48.617 31574-31618/com.xj.rnbearinandroid E/AndroidRuntime: FATAL EXCEPTION: create_react_context
Process: com.xj.rnbearinandroid, PID: 31574
java.lang.UnsatisfiedLinkError: couldn’t find DSO to load: libhermes.so
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:789)
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:639)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:577)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:525)
at com.facebook.hermes.reactexecutor.HermesExecutor.(HermesExecutor.java:20)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.java:29)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:997)
at java.lang.Thread.run(Thread.java:764)
2020-04-22 11:59:48.817 31574-31612/com.xj.rnbearinandroid E/SoLoader: couldn’t find DSO to load: libc++_shared.so caused by: dlopen failed: “/data/data/com.xj.rnbearinandroid/lib-main/libc++_shared.so” has unexpected e_machine: 40 (EM_ARM)
2020-04-22 11:59:48.821 31574-31612/com.xj.rnbearinandroid E/SoLoader: couldn’t find DSO to load: libglog.so caused by: APK was built for a different platform
2020-04-22 11:59:48.824 31574-31612/com.xj.rnbearinandroid E/SoLoader: couldn’t find DSO to load: libglog_init.so caused by: couldn’t find DSO to load: libglog.so caused by: APK was built for a different platform
2020-04-22 11:59:48.826 31574-31612/com.xj.rnbearinandroid E/SoLoader: couldn’t find DSO to load: libreactnativejni.so caused by: couldn’t find DSO to load: libglog_init.so caused by: couldn’t find DSO to load: libglog.so caused by: APK was built for a different platform

react-native版本:
“dependencies”: {
“react”: “16.11.0”,
“react-native”: “0.62.2”
},
是react-native版本的问题还是什么原因,如果是版本的问题怎么在0.6版本上进行适配

正在回答 回答被采纳积分+3

1回答

CrazyCodeBoy 2020-04-23 09:03:46

RN版本不同配置也不同,上述问题由未正确配置配置hermes导致的,参考下:

https://www.devio.org/2020/04/19/React-Native-Hybrid-Android/#couldnt-find-dso-to-load-libhermesso


1 回复 有任何疑惑可以回复我~
  • 我也遇到这个问题了,老师你上面的链接失效了
    回复 有任何疑惑可以回复我~ 2023-02-23 15:37:06
  • 在stackoverflow中找到答案。
    在根目录下的build.gradle做如下修改:
    android: {
    ...
    }
    project.ext.react = [
        enableHermes: false
    ]
    def jscFlavor = "org.webkit:android-jsc:+"
    def enableHermes = project.ext.react.get("enableHermes", false);
    dependencies {
    ...
    if ( enableHermes ) {
            def hermesPath = "../../node_modules/hermesvm/android/"
            debugImplementation files(hermesPath + "hermes-debug-aar")
            releaseImplementation files(hermesPath + "hermes-release.aar")
        } else {
            implementation jscFlavor
        }
    }
    回复 有任何疑惑可以回复我~ 2023-02-23 16:04:07
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信