React Native Firebase Crashlitics:找不到 DSO libhermes.so

Gay*_*d.P 5 react-native

我刚刚设置了 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] 本机 lib 目录:/data/app/~~DAa5QmzRi5oxpzp3KsccGQ==/com. wololofit-EEiD-rJZDFCbRjzPj4o-mQ==/lib/arm64 结果:0

根据我的研究,此错误适用于某些不支持 Hermes 的设备:https://github.com/facebook/react-native/issues/29528

经常提出几种解决方案:

解决方案1.添加到android/app/build.gradle

implementation 'com.facebook.soloader:soloader:0.9.0+'
Run Code Online (Sandbox Code Playgroud)

解决方案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
}
Run Code Online (Sandbox Code Playgroud)

解决方案3.添加:

def enableSeparateBuildPerCPUArchitecture = true

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = true
Run Code Online (Sandbox Code Playgroud)

这些提议可以追溯到几个不同的时期。我的手机上没有出现此崩溃(在 Crashlitics 上找到),我不知道该选择哪种解决方案。

Moh*_*mad 1

我总是可以通过添加解决方案1来解决这个奇怪的问题implementation 'com.facebook.soloader:soloader:0.9.0+'

但最近它没有帮助,这个解决方法修复了它(react-native-0.63.4

android/app/build.gradle

android: {
    ...
    packagingOptions {
        pickFirst 'lib/x86/libc++_shared.so'
        pickFirst 'lib/x86_64/libc++_shared.so'
        pickFirst 'lib/armeabi-v7a/libc++_shared.so'
        pickFirst 'lib/arm64-v8a/libc++_shared.so'
    }
    defaultConfig {
       ...
    }
    ...

}
Run Code Online (Sandbox Code Playgroud)