Android混合开发问题

来源:16-7 React Native 混合开发实战(Android篇)-5【解锁新的开发方式】

安卓android4132948

2020-04-22

图片描述

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版本上进行适配

写回答

1回答

CrazyCodeBoy

2020-04-23

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

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


1
2
慕先生4633558
在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
共2条回复

RN入门到进阶,打造高质量上线App

解锁React Native开发应用新姿势,React Native新版本热门技术

3144 学习 · 3241 问题

查看课程