相关文章推荐
月球上的菠菜  ·  React之shouldComponentU ...·  1 年前    · 
胆小的单杠  ·  Azure RHEL 8 Virtual ...·  1 年前    · 

将React Native升级到0.60-RC2后,发现库 "libjsc.so "没有找到。

27 人关注

我已经将React Native更新到0.60-RC2,使用Android Studio折射器迁移到AndroidX,并使用了这里提到的jetifier。 https://github.com/react-native-community/discussions-and-proposals/issues/129

这样做之后,我在运行 react-native run-android 时得到了错误 library "libjsc.so" not found 。我在运行发布的APK时得到了同样的错误。

堆栈跟踪是。

06-24 15:55:01.823  8579  8656 E SoLoader: Error when loading lib: dlopen failed: library "libjsc.so" not found lib hash: 83f1717c1dc187d9f252a9f1fc66d430 search path is /data/app/com.jtv.testapp-4hvCKbqEmbyyOPykuQhm4Q==/lib/arm
06-24 15:55:01.823  8579  8656 E SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
06-24 15:55:01.825  8579  8656 E AndroidRuntime: FATAL EXCEPTION: create_react_context
06-24 15:55:01.825  8579  8656 E AndroidRuntime: Process: com.jtv.testapp, PID: 8579
06-24 15:55:01.825  8579  8656 E AndroidRuntime: java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libjsc.so" not found
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:738)
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:591)
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:529)
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:484)
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at com.facebook.react.jscexecutor.JSCExecutor.<clinit>(JSCExecutor.java:19)
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at com.facebook.react.jscexecutor.JSCExecutorFactory.create(JSCExecutorFactory.java:29)
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:949)
06-24 15:55:01.825  8579  8656 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:764)

My package.json is:

"name": "TestApp", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" "dependencies": { "@react-native-community/async-storage": "^1.2.0", "@react-native-community/blur": "^3.3.1", "@react-native-community/netinfo": "^1.2.3", "@react-native-community/slider": "^1.0.4", "axios": "^0.18.0", "jetifier": "^1.4.0", "native-base": "^2.10.0", "prop-types": "^15.6.2", "qs": "^6.6.0", "react": "^16.8.6", "react-native": "^0.60.0-rc.2", "react-native-appsee": "^2.6.21", "react-native-device-info": "^0.24.3", "react-native-dialog": "^5.5.0", "react-native-draggable-flatlist": "^1.1.7", "react-native-elements": "^0.19.1", "react-native-email": "^1.0.2", "react-native-fast-image": "^5.1.2", "react-native-gesture-handler": "^1.0.12", "react-native-iap": "^2.4.0", "react-native-image-picker": "^0.28.0", "react-native-iphone-x-helper": "^1.2.0", "react-native-keyboard-aware-scroll-view": "^0.8.0", "react-native-kochava-tracker": "^1.1.0", "react-native-linear-gradient": "^2.5.3", "react-native-material-dropdown": "^0.11.1", "react-native-modal": "^9.0.0", "react-native-orientation": "^3.1.3", "react-native-scrollable-tab-view": "^0.10.0", "react-native-snap-carousel": "^3.7.5", "react-native-super-grid": "^2.4.4", "react-native-tab-view": "^1.3.1", "react-native-underline-tabbar": "^1.3.6", "react-native-vector-icons": "^6.1.0", "react-native-video": "^4.3.1", "react-native-webview": "^5.12.0", "react-navigation": "^3.0.9", "react-navigation-backhandler": "^1.2.0", "react-redux": "^6.0.1", "redux": "^4.0.1", "redux-logger": "^3.0.6", "redux-thunk": "^2.3.0" "devDependencies": { "@babel/core": "^7.4.0", "@babel/runtime": "^7.4.2", "@react-native-community/eslint-config": "^0.0.3", "babel-jest": "^24.5.0", "babel-plugin-transform-remove-console": "^6.9.4", "eslint": "^5.15.3", "eslint-config-airbnb": "^17.1.0", "eslint-plugin-import": "^2.16.0", "eslint-plugin-jsx-a11y": "^6.2.1", "eslint-plugin-react": "^7.12.4", "eslint-plugin-react-hooks": "^1.5.1", "jest": "^24.5.0", "metro-react-native-babel-preset": "^0.53.1", "react-devtools-core": "^3.6.0", "react-test-renderer": "^16.8.6", "remote-redux-devtools": "^0.5.16" "jest": { "preset": "react-native"

My build.gradle is:

apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
        entryFile: "index.js"
apply from: "../../node_modules/react-native/react.gradle"
def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false
project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'FontAwesome.ttf', 'MaterialCommunityIcons.ttf' ]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
android {
    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion
    defaultConfig {
        applicationId "com.jtv.testapp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 29
        versionName "0.0.1"
        multiDexEnabled true
        renderscriptTargetApi 29
        renderscriptSupportModeEnabled true
        ndk {
            abiFilters "arm64-v8a", "x86_64","armeabi-v7a", "x86"
        packagingOptions {
            pickFirst 'lib/x86_64/libjsc.so'
            pickFirst 'lib/arm64-v8a/libjsc.so'
            exclude "lib/arm64-v8a/libimagepipeline.so"
            exclude "lib/arm64-v8a/librealm-jni.so"
    signingConfigs {
        release {
            if (project.hasProperty('RELEASE_STORE_FILE')) {
                storeFile file(RELEASE_STORE_FILE)
                storePassword RELEASE_STORE_PASSWORD
                keyAlias RELEASE_KEY_ALIAS
                keyPassword RELEASE_KEY_PASSWORD
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
dependencies {
    implementation project(':react-native-webview')
    implementation project(':react-native-jtv-comic-reader')
    //implementation project(':@react-native-community_slider')
    implementation project(':@react-native-community_blur')
    implementation project(':@react-native-community_async-storage')
    implementation project(':@react-native-community_netinfo')
    implementation project(':react-native-appsee')
//    implementation project(':react-native-tune-sdk')
    implementation project(':react-native-iap')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-video')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-orientation')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-kochava-tracker')
//    implementation project(':react-native-flurry-analytics')
    implementation project(':react-native-device-info')
//    implementation project(':react-native-fbsdk')
    implementation project(':react-native-fast-image')
    implementation project(':react-native-image-picker')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.facebook.fresco:fresco:1.13.0'
    implementation 'com.facebook.fresco:animated-gif:1.13.0'
    implementation 'androidx.mediarouter:mediarouter:1.0.0'
    implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.11.2'
    implementation 'com.google.android.gms:play-services-ads:18.0.0'
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
    implementation 'androidx.multidex:multidex:2.0.1'
    implementation 'com.google.android.gms:play-services-ads-identifier:17.0.0'
    implementation 'com.android.installreferrer:installreferrer:1.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.facebook.android:facebook-android-sdk:4.36.1'
    implementation 'com.swrve.sdk.android:swrve-firebase:6.0.1'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-messaging:19.0.0'
    implementation 'androidx.mediarouter:mediarouter:1.0.0'
    implementation 'com.google.android.gms:play-services-cast:17.0.0'
    implementation 'com.googlecode.android-query:android-query:0.25.9'
    implementation 'com.google.android.gms:play-services-cast-framework:17.0.0'
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
apply plugin: 'com.google.gms.google-services'

什么是libjsc.so文件,我如何解决这个错误?

2 个评论
open gradle.properties => add Android.useDeprecatedNdk=true
它已经在那里了。我仍然收到错误信息。
android
react-native
gradle
android-gradle-plugin
androidx
khateeb
khateeb
发布于 2019-06-24
6 个回答
Bhaskar Gyan Vardhan
Bhaskar Gyan Vardhan
发布于 2020-02-26
已采纳
0 人赞同

在你的app/build.gradle中加入以下内容

// On top of the file

def useIntlJsc = false

//inside dependencies

 if (useIntlJsc) {
        implementation 'org.webkit:android-jsc-intl:+'
    } else {
        implementation 'org.webkit:android-jsc:+'
    
实际上,我删除了旧的项目,从 react-native init 创建了一个新的项目,并将我的代码复制到新的项目中,结果成功了。所以我无法测试这个修复方法。 如果你百分之百确定这个方法有效,那么我就把这个标记为接受。
昨天有同样的问题,我是这样解决的。在新项目中,你会得到上述默认设置。你可以在你生成的app/build.gradle中进行验证
这摆脱了 libjsc.so 的错误,但现在我在一个新的RN 0.60 RC2项目上得到了 libgnustl_shared.so 没有找到。
这个解决方案并不奏效。我得到 /com.simplewebview E/SoLoader: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libgnustl_shared.so" not found /com.simplewebview E/AndroidRuntime:FATAL EXCEPTION: create_react_context Process: com.simplewebview, PID: 26654 java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libjscexecutor.so caused by: dlopen failed: library "libgnustl_shared.so" not found
libgnustl_shared.so 中也遇到了同样的问题。 有没有人有解决方案,并能合理解释为什么它不在react-native文档中?
Francois Nadeau
Francois Nadeau
发布于 2020-02-26
0 人赞同

我也遇到了这个问题。我需要在build.gradle文件中更新 jscFlavor 这个变量。

def jscFlavor = 'org.webkit:android-jsc:+'

To this:

def jscFlavor = 'org.webkit:android-jsc-intl:+'

Cheers.

这个人实际上救了我。非常感谢你。我确实在我的应用程序中使用了i18n。
anthonyhumphreys
anthonyhumphreys
发布于 2020-02-26
0 人赞同

我遇到了这个bug的一个小变化,我在gradle配置中添加了第三个buildType,"releaseStaging"。

在这个例子中,修复方法是在app/build.gradle的依赖关系中添加以下一行

releaseStagingImplementation files(hermesPath + "hermes-release.aar")

拯救了我!,我正在使用一个自定义的分期付款变体,而Hermes并不工作,谢谢!。
这里也一样。Hermes必须在每个需要它的buildType中被启用。这个改变为我解决了这个问题
Tiago Gouvêa
Tiago Gouvêa
发布于 2020-02-26
0 人赞同

对我来说,解决的方法是将build.gradle更新 packagingOptions 改为。

  packagingOptions {
       pickFirst 'lib/x86/libc++_shared.so'
       pickFirst 'lib/x86/libjsc.so'
       pickFirst 'lib/x86_64/libjsc.so'
       pickFirst 'lib/arm64-v8a/libjsc.so'
       pickFirst 'lib/arm64-v8a/libc++_shared.so'
       pickFirst 'lib/x86_64/libc++_shared.so'
       pickFirst 'lib/armeabi-v7a/libc++_shared.so'
       pickFirst 'lib/armeabi-v7a/libjsc.so'
    
我在build.gradle中没有看到这些。 这是新设置的 react-native 的一部分吗? react-native-community.github.io/upgrade-helper/...
HarshitMadhav
HarshitMadhav
发布于 2020-02-26
0 人赞同

好的!在最近的react native版本中,直到今天,这个问题仍在发生,并在你集成在应用程序中的crashlytics中被报告,或者你可以在日志中看到它。

This issue only comes when you have Hermes engine enabled.

这是我的修复方法 我面临这个问题,在我的情况下,需要Hermes,所以,我设法通过安装 "libjsc.so" not found jsc-android 包来修复这个 npm 。这里是 link .

Please NOTE :请参考该软件包的文档,根据你的react native版本进行正确安装。

清理gradle并重新运行整个应用程序,这个问题就会消失。

Jose Kj
Jose Kj
发布于 2020-02-26
0 人赞同

在我的案例中,这个错误与react-native-screen有关,在android/app/build.gradle中添加以下内容 以下两行到android/app/build.gradle的依赖部分,为我解决了这个问题