昨天,我的react-native应用运行良好,但在成功编译(gradle和build)并运行应用后,我收到以下错误消息:
2021-10-08 14:51:51.378 7178-7178/com.appname E/SoLoader: couldn't find DSO to load: libjsijniprofiler.so caused by: dlopen failed: library "libhermes.so" not found: needed by /data/app/~~p8ttNiYyXwU4wozNVHBjGQ==/com.appname-nVEXUjtlwdrOPFZH2SvGwQ==/lib/x86/libjsijniprofiler.so in namespace classloader-namespace result: 0
2021-10-08 14:51:51.382 7178-7178/com.appname E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.appname, PID: 7178
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjsijniprofiler.so caused by: dlopen failed: library "libhermes.so" not found: needed by /data/app/~~p8ttNiYyXwU4wozNVHBjGQ==/com.appname-nVEXUjtlwdrOPFZH2SvGwQ==/lib/x86/libjsijniprofiler.so in namespace classloader-namespace result: 0
在过去的两天里,我尝试了100种不同的解决方案......我尝试了:
implementation 'com.facebook.soloader:soloader:0.9.0+'
我有这个项目的建设。Gradle:
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
maven { url "https://jitpack.io" }
jcenter()
google()
mavenCentral()
}
}
我在app/build.gradle的packagingOptions中尝试了各种组合
packagingOptions {
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/x86_64/libjsc.so'
/*pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'*/
}
我尝试将react-native从0.65.1升级到0.66.0
我试过让爱马仕
project.ext.react = [
entryFile: "index.js",
enableHermes: true, // clean and rebuild if changing
]
def enableHermes = project.ext.react.get("enableHermes", true)
...
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
else {
implementation jscFlavor
我试过了
ndk { abiFilters 'armeabi-v7a', 'x86' }
在默认配置中
我尝试过将jscFlavor从jsc更改为jsc-intl
def jscFlavor = 'org.webkit:android-jsc-intl:+'
//def jscFlavor = 'org.webkit:android-jsc:+'
我尝试了不同版本的AndroidStudio。我在Windows机器上尝试,而不是我的Mac。
$> npm info
System:
OS: macOS 11.6
CPU: (12) x64 Intel(R) Core(TM) i7-8700B CPU @ 3.20GHz
Memory: 49.68 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.10.0 - /usr/local/bin/node
Yarn: 1.22.15 - /usr/local/bin/yarn
npm: 7.24.0 - /usr/local/bin/npm
Watchman: 2021.10.04.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /Users/rubenmagic/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
Android SDK:
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7678000
Xcode: 13.0/13A233 - /usr/bin/xcodebuild
Languages:
Java: 11.0.11 - /usr/bin/javac
npmPackages:
@react-native-community/cli: 6.0.1 => 6.0.1
react: ^17.0.2 => 17.0.2
react-native: ^0.66.0 => 0.66.0
react-native-macos: Not Found
应用程序级构建.gradle
apply plugin: "com.android.application"
project.ext.react = [
entryFile: "index.js",
enableHermes: true, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
def jscFlavor = 'org.webkit:android-jsc-intl:+'
//def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", true)
android {
//ndkVersion rootProject.ext.ndkVersion
compileSdkVersion 30
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
flatDir { dirs 'libs' }
}
defaultConfig {
applicationId "com.incidentshare"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "0.7.0"
buildConfigField "String", "EXO_VERSION", "\"2.11.4\""
multiDexEnabled true //Ruben TODO: Try and disable for performance upgrade
ndk {
//abiFilters 'armeabi-v7a', 'x86'
}
}
/*splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}*/
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release'
/*applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(com.android.build.OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}*/
packagingOptions {
pickFirst 'lib/arm64-v8a/libjsc.so'
//pickFirst 'lib/x86_64/libjsc.so'
/*pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'*/
}
}
dependencies {
implementation "com.facebook.soloader:soloader:0.9.0+"
apply from: '../../node_modules/react-native-unimodules/gradle.groovy'
addUnimodulesDependencies()
implementation (name: 'libgrafika-release', ext: 'aar')
implementation (name: 'libsldp-release', ext: 'aar')
//implementation project(':appBroadcast')
//noinspection GradleDynamicVersion
implementation 'com.facebook.soloader:soloader:0.10.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.google.android.material:material:1.4.0'
implementation "com.facebook.react:react-native:${reactNativeVersion}" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.github.satyan:sugar:1.4'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'com.github.seancfoley:ipaddress:5.3.3'
implementation "com.google.android.exoplayer:exoplayer-core:2.13.3"
implementation "com.google.android.exoplayer:exoplayer-dash:2.13.3"
implementation "com.google.android.exoplayer:exoplayer-hls:2.13.3"
implementation "com.google.android.exoplayer:exoplayer-ui:2.13.3"
implementation 'com.google.android:flexbox:2.0.1'
implementation 'com.github.permissions-dispatcher:permissionsdispatcher:4.9.1'
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-core'
//implementation 'com.google.firebase:firebase-messaging'
//implementation "com.google.firebase:firebase-messaging:22.0.0"
implementation project(':react-native-push-notification')
annotationProcessor 'org.permissionsdispatcher:permissionsdispatcher-processor:4.7.0'
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.13'
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
apply plugin: "com.google.gms.google-services"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle");
applyNativeModulesAppBuildGradle(project)
当然我试过了
gradlew clean
react-native start --clean-cache
和所有的东西。
请任何人帮助!我已经尝试了谷歌上的每一个相关链接,并阅读了每一个git错误报告,我可以找到,没有帮助...没有我更新或做任何事情的项目?
提前致谢;)
2条答案
按热度按时间hmtdttj41#
你有没有试过对你得到的每个变体都这样做?正如你所看到的,我为qa变体添加了释放爱马仕。
在我添加了我的qa变体后,这对我来说有些作用,但它仍然失败,但有不同的错误:找不到要加载DSO:libhermes.so,原因是:找不到要加载的DSO:libjsi.so
而且我可以在QA APK中看到它确实有libhermes.so(只是缺少libjsi.so一个...)
7tofc5zh2#
更新您正在使用的SoLoader版本。
https://github.com/facebook/SoLoader/releases
已在v0.10.3中修复