web-dev-qa-db-ja.com

アップグレード後にライブラリ「libjsc.so」が見つからないReact Native to 0.60-RC2

私はReact Nativeを0.60-RC2に更新し、Android Studio refractorを使用してAndroidXに移行し、ここで説明したJetifierを使用しました: https:/ /github.com/react-native-community/discussions-and-proposals/issues/129

これを行った後、library "libjsc.so" not foundを実行するとエラーreact-native run-Androidが発生します。リリース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)

私のpackage.jsonは:

{
  "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"
  }
}

私のbuild.gradleは:

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ファイルとは何ですか?このエラーを解決するにはどうすればよいですか?

13
khateeb

このバグのわずかなバリエーションに遭遇し、3番目のbuildTypeをGradle構成に追加しました(「releaseStaging」)。

このインスタンスの修正は、app/build.gradleの依存関係に次の行を追加することでした

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

0

私の場合、このエラーはreact-native-screenに関連しており、次の2行をAndroid/app/build.gradleの依存関係セクションに追加すると問題が解決しました

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

出典: このGithubの回答を確認してください

0
Jose Kj