facebook / SoLoader

Native code loader for Android
Apache License 2.0
1.34k stars 176 forks source link

couldn't find DSO to load: libhermes-executor-debug.so #111

Open uuzelac opened 2 years ago

uuzelac commented 2 years ago

Description: After upgrading React Native project from 0.65.0 to 0.70.4 I end up in a problem with crashing app on start. The error appears in both debug and release build but in release build error cause app to freeze on splash screen. I tried all available solutions online but nothing didn't help.

Build.gradle:

project.ext.react = [
        enableHermes: true,
        enableVmCleanup: false,
]

apply from: '../../node_modules/react-native/react.gradle'

def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = true
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get('enableHermes', true)
def reactNativeArchitectures() {
    def value = project.getProperties().get("reactNativeArchitectures")
    return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

My dependencies:

dependencies {

    implementation platform('com.google.firebase:firebase-bom:28.4.0')

    implementation 'com.facebook.soloader:soloader:0.10.4+'

    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

    implementation 'androidx.work:work-runtime-ktx:2.7.0'

    implementation 'com.android.support:multidex:1.0.3'
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.facebook.react:react-native:' // From node_modules

    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'androidx.annotation:annotation:1.2.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

    implementation 'com.google.android.gms:play-services-base:17.6.0'

    implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
    implementation project(':react-native-config')

    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'
    }

    huaweiImplementation 'com.huawei.hms:hianalytics:6.3.0.302'

    if (enableHermes) {
        //noinspection GradleDynamicVersion
        implementation("com.facebook.react:hermes-engine:+") { // From node_modules
            exclude group:'com.facebook.fbjni'
        }
    } else {
        implementation jscFlavor
    }
}
HimanshuNarang commented 2 years ago

Facing the same issue, any solution?

simpleton commented 1 year ago

can you guys share the logcat log or the apk that I can reproduce the crash? thank you!

uuzelac commented 1 year ago

After long process of trial and error, we finally found out what was causing Android realise build to freeze at start up. It was babel-plugin-minify-dead-code-elimination that we were using in our project.

In our babel.config.js file there was this plugin enabled

env: {
   production: {
     plugins: [['minify-dead-code-elimination', { optimizeRawSize: true }]],
   },
}

after upgrading babel-plugin-minify-dead-code-elimination from 0.5.1 to 0.5.2 we finally managed to build our Android realise build successfully.

I hope that this will help someone upgrading from RN 0.65.0 to newer version and save a lot of hours of searching for the solution.

About libhermes-executor-debug.so, this actually will not cause your app stop working. You can try realise build with new clean project and you will see the same error message. If your app is not working it is not up to libhermes-executor-debug.so it is something else.

Happy hacking!