0

it is a working app that has been deployed for a year now...nothing major was changed but suddenly this started appearing: Fatal: couldn't find DSO to load: libhermes-executor-release.so

I have tried the following already:

  1. lowering the SOLoader version
  2. upgrading soLoader to the latest version avaliable
  3. Changing build variant (I only have debug and release only)

and otehr solutions recommended but nothing seems to work. I can't upgrade react-native now since we have a bit involved native libs/dependencies in place already that would break. I am on react native 0.67.4. My builde gradle looks like this:

    apply plugin: "com.android.application"
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    apply plugin: 'com.google.gms.google-services'
    
    import com.android.build.OutputFile
    
    
    
    project.ext.react = [
        enableHermes: true,  // clean and rebuild if changing,
        hermesFlagsRelease: ["-w", "-O", "-output-source-map"], // add this,
        hermesFlagsDebug: ["-w", "-O", "-output-source-map"], // add this,
        bundleAssetName: "index.android.bundle",
        entryFile: "index.js",
        bundleInDebug: false,
        bundleInRelease: true,
        devDisabledInStaging: true,
        root: "../../",
        jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
        jsBundleDirRelease: "$buildDir/intermediates/assets/release",
        resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
        resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
    ]
    
    project.ext.sentryCli = [
        logLevel: "debug",
        sentryProperties: "../sentry.properties"
    ]
    
    apply from: "../../node_modules/react-native/react.gradle"
    apply from: "../../node_modules/@sentry/react-native/sentry.gradle"
    
    def enableSeparateBuildPerCPUArchitecture = true
    
    def enableProguardInReleaseBuilds = true
    
    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", true);
    
    project.ext.envConfigFiles = [
            debug: ".env",
            release: "release.env"
    ]
    
    //to avoid building issues with mahcrest and junit in so emlibraries, likely signaturepad
    //https://stackoverflow.com/questions/59085448/duplicate-class-org-hamcrest-basedescription-found-in-modules-jetified-hamcrest
    configurations.all {
        resolutionStrategy.dependencySubstitution {
            substitute module('org.hamcrest:hamcrest-core:1.1') with module('junit:junit:4.12')
        }
    }
    
    
    
    android {
        compileSdkVersion rootProject.ext.compileSdkVersion
        kotlinOptions { jvmTarget = JavaVersion.VERSION_1_8 }
        // ndkVersion '21.3.6528147'   // The version installed on build machines, see https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu1804-README.md
        buildFeatures {
            viewBinding true
        }
    
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
    
        defaultConfig {
            applicationId "org.oneacrefund.fieldapp"
            minSdkVersion rootProject.ext.minSdkVersion
            targetSdkVersion rootProject.ext.targetSdkVersion
            versionCode 40
            versionName "1.8.6"
            multiDexEnabled true
            testBuildType System.getProperty('testBuildType', 'debug')  // This will later be used to control the test apk build type
            testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
        }
        splits {
            abi {
                reset()
                enable enableSeparateBuildPerCPUArchitecture
                universalApk true  // 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'
            }
    
            release {
                // You can set these in your own ~/.gradle/gradle.properties
                if (project.hasProperty('FOAPP_RELEASE_STORE_FILE')) {
                    storeFile file(FOAPP_RELEASE_STORE_FILE)
                    storePassword FOAPP_RELEASE_STORE_PASSWORD
                    keyAlias FOAPP_RELEASE_KEY_ALIAS
                    keyPassword FOAPP_RELEASE_KEY_PASSWORD
                }
            }
        }
        namespace 'org.oneacrefund.fieldapp'
        buildTypes {
            debug {
                signingConfig signingConfigs.debug
            }
            release {
                // Caution! In production, you need to generate your own keystore file.
                // see https://facebook.github.io/react-native/docs/signed-apk-android.
                signingConfig signingConfigs.release
                matchingFallbacks = ['release']
                minifyEnabled enableProguardInReleaseBuilds
                proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
                proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
    
            }
            stagingrelease {
                initWith(buildTypes.release)
                applicationIdSuffix ".staging"
            }
    
            productionrelease {
                initWith release
            }
        }
        packagingOptions {
            jniLibs {
                pickFirsts += ['lib/x86/libc++_shared.so', 'lib/x86_64/libc++_shared.so', 'lib/armeabi-v7a/libc++_shared.so', 'lib/arm64-v8a/libc++_shared.so', '**/*.so', 'lib/armeabi-v7a/libc++_shared.so', 'lib/arm64-v8a/libc++_shared.so', 'lib/x86/libc++_shared.so', 'lib/x86_64/libc++_shared.so']
            }
        }
    
    
        // 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:0.67.3"  // From node_modules
    
        implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
        implementation 'com.googlecode.json-simple:json-simple:1.1.1'
    
    
        androidTestImplementation 'junit:junit:4.12'
        implementation "androidx.annotation:annotation:1.1.0"
    
        //implementation 'com.google.code.gson:gson:2.8.6'
    
        debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
          exclude group:'com.facebook.fbjni'
        }
    
        debugImplementation project(':flipper-plugin-rn-performance-android')
    
        debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
            exclude group:'com.facebook.flipper'
        }
    
        debugImplementation ("com.facebook.flipper:flipper-leakcanary2-plugin:${FLIPPER_VERSION}"){
                  exclude group:'com.facebook.fbjni'
        }
        debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
    
    
        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
        }
        implementation "androidx.core:core-ktx:1.6.0"
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        implementation project(':reactnativesignaturecapture')
    }
    
    // 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'
    }
    
    project.ext.vectoricons = [
        iconFontNames: [ 'MaterialIcons.ttf', 'MaterialCommunityIcons.ttf' ] // Name of the font files you want to copy
    ]
    apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
    apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
    apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
    
    repositories {
        mavenCentral()
    }
Bhuvaneshwaran
  • 192
  • 1
  • 2
  • 10
Nie Selam
  • 1,343
  • 2
  • 24
  • 56

0 Answers0