React-Nativeアプリケーションを構築していますが、バージョン0.59.xからにアップグレードすることを決定するまで、すべてが正常に機能しましたv 0.61.5。
Playストアでアプリをリリースしようとすると、 Firebase Crashlytics (v 6.2.0)-私のバージョンは内部テストでのみ利用可能ですが、それが リリース前レポート プレイストアによってトリガーされる必要があります- -まったく同じデバイスの場合はまったく同じエラーです=>LGE Nexus 5X Android 6.0.1。
Fatal Exception: Java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libhermes.so
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.Java)
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.Java)
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.Java)
at com.facebook.soloader.SoLoader.assertInitialized(SoLoader.Java)
at com.facebook.hermes.reactexecutor.HermesExecutor.<clinit>(HermesExecutor.Java)
at com.facebook.hermes.reactexecutor.HermesExecutorFactory.create(HermesExecutorFactory.Java)
at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.Java)
at Java.lang.Thread.run(Thread.Java:818)
この問題を解決するために、わずかに異なるAndroid構成を使用して複数のバージョンを送信しようとしました(たとえば、hermes有効化の有無にかかわらず))が、最終結果を変更しません。
これが私のbuild.gradleファイルです:
apply plugin: "com.Android.application"
apply plugin: "io.fabric"
import com.Android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.Android.bundle",
*
* // the entry file for bundle generation
* entryFile: "index.Android.js",
*
* // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.Android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in Android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in Android/
* // for example, you might want to remove it from here.
* inputExcludes: ["Android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = true
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:Android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:Android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
def _applicationId = System.getenv("GRADLE_APP_IDENTIFIER") ?: 'com.clothparency.debug'
def appName = System.getenv("GRADLE_APP_NAME") ?: 'Clear Fashion debug'
def _versionCode = (System.getenv("Android_VERSION_CODE") ?: "1") as Integer
def _versionName = System.getenv("Android_VERSION_NAME") ?: "1.0.0"
Android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/androidx.exifinterface_exifinterface.version'
}
defaultConfig {
applicationId _applicationId
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode _versionCode
versionName _versionName
missingDimensionStrategy 'react-native-camera', 'mlkit'
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
release {
storeFile file(String.valueOf(System.getenv("GRADLE_KEYSTORE")))
storePassword System.getenv("GRADLE_KEYSTORE_PASSWORD")
keyAlias System.getenv("GRADLE_KEYSTORE_ALIAS")
keyPassword System.getenv("GRADLE_KEYSTORE_ALIAS_PASSWORD")
}
}
buildTypes {
debug {
resValue "string", "app_name", appName
debuggable true
proguardFiles getDefaultProguardFile("proguard-Android.txt"), "proguard-rules.pro"
}
release {
resValue "string", "app_name", appName
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 ->
// 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(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
configurations.all {
resolutionStrategy {
force "com.facebook.soloader:soloader:0.8.1"
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/Android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
implementation 'com.Android.support:multidex:1.0.3'
}
// 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'
apply from: file("../../node_modules/@react-native-community/cli-platform-Android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
また、私のルートbuild.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath('com.Android.tools.build:gradle:3.5.3')
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
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")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
ここに私のpackage.jsonの依存関係があります:
"dependencies": {
"@react-native-community/async-storage": "^1.6.1",
"@react-native-firebase/analytics": "^6.2.0",
"@react-native-firebase/app": "^6.2.0",
"@react-native-firebase/auth": "^6.2.0",
"@react-native-firebase/crashlytics": "^6.2.0",
"@react-native-firebase/perf": "^6.2.0",
"axios": "^0.18.0",
"fast-levenshtein": "^2.0.6",
"formik": "^1.5.7",
"i18n-js": "^3.2.2",
"jetifier": "^1.6.5",
"lodash": "^4.17.11",
"react": "16.9.0",
"react-native": "0.61.5",
"react-native-camera": "^3.13.1",
"react-native-dialog": "^5.6.0",
"react-native-fbsdk": "^1.1.1",
"react-native-formik": "^1.7.5",
"react-native-gesture-handler": "^1.5.2",
"react-native-localize": "^1.1.2",
"react-native-reanimated": "^1.4.0",
"react-native-screens": "^1.0.0-alpha.23",
"react-native-swiper": "^1.6.0-rc.3",
"react-native-tab-view": "^2.11.0",
"react-navigation": "3.13.0",
"react-navigation-tabs": "^2.6.2",
"react-persist": "^1.0.2",
"react-redux": "^7.0.3",
"redux": "^4.0.1",
"redux-devtools-extension": "^2.13.8",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"reselect": "^4.0.0",
"unorm": "^1.6.0",
"yup": "^0.27.0"
}
私はこのトピックについて話しているこのgithubの問題を見つけました:
しかし、ここで説明されている解決策は私にとってうまくいきませんでした。
Stackoverflowでこのスレッドも見つかりました: React-Native:Java.lang.UnsatisfiedLinkError:ロードするDSOが見つかりませんでした:libhermes.so :エラーは私のものと少し異なるようですが、解決策はありませんでしたt動作します。
新しいバージョンを製品版にリリースするのが怖くて、完全に行き詰まっています。迅速な支援が必要:)
apk
ではなく aab
を生成することでこの問題を解決しました。
しかし、生成される余分な重みのため、私はこの修正に深く不満を抱いており、それが一時的な解決策であることを願っています。
編集
別の解決策が見つかったので、これをbuild.gradle
ファイル。副作用はわかりませんが、少なくともcrashlyticsによるこのエラーは発生しなくなりました。しかし、一部のデバイスでまだ問題があるようです。
Android {
defaultConfig {
// let your old config
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
}
2回目の編集
ソリューション2番目のソリューションは、一部のデバイスを私のアプリと互換性のないものにします。 @AlexandrDobrovolskiyによって書かれたgithubの新しい答えは私にとって正しい答えでした
SoLoaderをバージョン0.82に強制する
build.gradle
ファイル:
configurations.all {
resolutionStrategy {
force "com.facebook.soloader:soloader:0.8.2"
}
}