我刚刚设置了Firebase Crashlitics并看到了这个错误:
致命异常: java.lang.UnsatisfiedLinkError 找不到要加载的DSO:libhermes.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.wololofit/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~DAa5QmzRi5oxpzp3KsccGQ==/com.wololofit-EEiD-rJZDFCbRjzPj4o-mQ==/lib/arm64 flags = 0] SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2] SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2] Native lib dir: /data/app/~~DAa5QmzRi5oxpzp3KsccGQ==/com.wololofit-EEiD-rJZDFCbRjzPj4o-mQ==/lib/arm64 result: 0
从我的研究来看,这个错误是由于某些不支持Hermes的设备引起的:https://github.com/facebook/react-native/issues/29528 通常会提出几种解决方案: 解决方案1:在
致命异常: java.lang.UnsatisfiedLinkError 找不到要加载的DSO:libhermes.so SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.wololofit/lib-main flags = 1] SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~DAa5QmzRi5oxpzp3KsccGQ==/com.wololofit-EEiD-rJZDFCbRjzPj4o-mQ==/lib/arm64 flags = 0] SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib64 flags = 2] SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib64 flags = 2] Native lib dir: /data/app/~~DAa5QmzRi5oxpzp3KsccGQ==/com.wololofit-EEiD-rJZDFCbRjzPj4o-mQ==/lib/arm64 result: 0
从我的研究来看,这个错误是由于某些不支持Hermes的设备引起的:https://github.com/facebook/react-native/issues/29528 通常会提出几种解决方案: 解决方案1:在
android/app/build.gradle
中添加:implementation 'com.facebook.soloader:soloader:0.9.0+'
解决方案 2. 添加:
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
qaImplementation files(hermesPath + "hermes-release.aar")
stageImplementation files(hermesPath + "hermes-release.aar")
prodImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
解决方案3:添加:
def enableSeparateBuildPerCPUArchitecture = true
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = true
这些提案来自不同的时期。 在我的手机上没有遇到过这个崩溃(它可以在Crashlitics上找到),我不知道应该选择哪个解决方案。