Solution 1 :
I believe this is very similar to an issue opened on github. You may want to subscribe to the thread for future updates on fixing the SoLoader
issue.
To fix this, one of the developers added the following under android/app/build.gradle
:
dependencies {
implementation 'com.facebook.soloader:soloader:0.9.0+'
...
}
As for me, because of my other dependencies relying on SoLoader
, i have added the following above my declared dependencies under android/app/build.gradle
:
configurations.all {
resolutionStrategy {
force "com.facebook.soloader:soloader:0.8.2"
}
}
dependencies {
...
}
My app now runs well without SoLoader
issue on Nexus 5s emulator.
Problem :
I created a basic react app On using it on redmi k20 as physical using usb debugging as well as nexus5s on emulator it crashes without showing any error
app.js
import React from 'react';
import {
Text,
View
} from 'react-native';
const App = () => {
return (
<View>
<Text>Ross Wala Haiii;</Text>
</View>
);
};
export default App;
app/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.storiesapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
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(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
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'
}
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
}
}
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
android/build.gradle
buildscript {
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 16
compileSdkVersion = 29
targetSdkVersion = 29
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.3")
// 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://www.jitpack.io' }
}
}
It shows:
java.lang.Unsatisfiedlinkerror: couldn't find DSO to load:
libfbjni.so result: 0
at com.facebook.soloader.SoLoader.doLoadLibraryBySoName(SoLoader.java:825) e(SoLoader.java:825) at
com.facebook.soloader.SoLoader.loadLibraryBySoName(S oLoader.java:673) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.jav a:611) at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.jav a:559) at
com.facebook.soloader.NativeLoaderToSoLoader Delegate.
loadLibrary(NativeLoaderToSoLoaderDelegate.java:25) at com.facebook.soloader.nativeloader. NativeLoader.loadLibr ary(NativeLoader.java:44) at com.facebook.jni.HybridData.<clinit>(HybridData.java:
34) at com.facebook.flipper.android. Flippers Thread.run(Flipper The ead.java:25)
I am using RN 16.13.1
on windows 10
It is my first experience with react native and may lack basic react native knowledge
Please Help
Comments
Comment posted by kenmistry
Do both methods not work for you? Even after running