首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >反应本机火基撞击:找不到DSO libhermes.so

反应本机火基撞击:找不到DSO libhermes.so
EN

Stack Overflow用户
提问于 2022-01-16 21:00:16
回答 2查看 1.8K关注 0票数 4

我刚刚设置了Firebase Crashlitics,我看到了这个错误:

致命例外: java.lang.UnsatisfiedLinkError无法找到要加载的DSO : libhermes.so SoSource 0: com.facebook.soloader.ApkSoSourceroot =/data/data/com.walolofit/ lib -主标志=1 SoSource 1: com.facebook.soloader.DirectorySoSourceroot = SoSource标志=0 SoSource 2: com.facebook.soloader.DirectorySoSourceroot =/供应商/lib 64标志=2 SoSource 3: com.facebook.soloader.DirectorySoSourceroot =/system/lib 64标志=2个本机lib dir:/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中:

代码语言:javascript
复制
implementation 'com.facebook.soloader:soloader:0.9.0+'

解决方案2.添加:

代码语言:javascript
复制
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.添加:

代码语言:javascript
复制
def enableSeparateBuildPerCPUArchitecture = true

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = true

这些建议可追溯到几个不同时期。在我的手机上没有这个问题(这是在Crashlitics上找到的),我不知道该选择哪种解决方案。

EN

回答 2

Stack Overflow用户

发布于 2022-01-26 00:21:49

选项1.

如果您使用的是react本机v0.64.2或更高版本,我不认为这是强制性的,因为它已经包括了soloader

选项2.

如果您正在使用react本机-config,或者通常使用自定义buildTypes,这是必需的,例如:

代码语言:javascript
复制
    buildTypes {
      debug {
        signingConfig signingConfigs.debug
      }
      // Added
      staging { 
        signingConfig signingConfigs.release
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        matchingFallbacks = ['release']        
      }
      release {
        signingConfig signingConfigs.release
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
      }
}

在这个示例中,我们添加了默认情况下不存在的staging构建类型。在本例中,我们需要将Hermes包括在分阶段构建类型中,方法是如下所示:

代码语言:javascript
复制
if (enableHermes) {
    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    stagingImplementation files(hermesPath + "hermes-debug.aar") // Added
    releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
    implementation jscFlavor
}

以及添加以下行以将调试器排除在暂存生成之外

代码语言:javascript
复制
project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
    
    devDisabledInStaging: true, // Added
    bundleInStaging: true, // Added
]
票数 2
EN

Stack Overflow用户

发布于 2022-01-25 08:19:54

我总是可以通过添加solution1 (即implementation 'com.facebook.soloader:soloader:0.9.0+' )来解决这个问题。

但是最近它没有起作用,而这个解决方法解决了它(react本机-0.63.4)

android/app/build.gradle

代码语言:javascript
复制
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 {
       ...
    }
    ...

}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70734154

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档