'react native release crash, java.lang.AbstractMethodError soloader

My react-native project works fine in android debug, android staging and ios build. but crash after success build in release env. The app closes immediately after running

It is parts of logcat "*:E"

--------- beginning of crash
03-25 17:24:37.329 17631 17724 E AndroidRuntime: FATAL EXCEPTION: create_react_context
03-25 17:24:37.329 17631 17724 E AndroidRuntime: Process: net.epicmobile.hometips, PID: 17631
03-25 17:24:37.329 17631 17724 E AndroidRuntime: java.lang.AbstractMethodError:abstract method "boolean com.facebook.soloader.o.b.a(java.lang.String, int)"
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at com.facebook.soloader.o.a.d(Unknown Source:8)
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at com.facebook.soloader.o.a.c(Unknown Source:1)
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at com.facebook.jni.HybridData.<clinit>(Unknown Source:2)
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at com.facebook.react.bridge.WritableNativeMap.initHybrid(Native Method)
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at com.facebook.react.bridge.WritableNativeMap.<init>(Unknown Source:0)
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at com.facebook.react.jscexecutor.a.create(Unknown Source:2)
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at com.facebook.react.q$e.run(Unknown Source:58)
03-25 17:24:37.329 17631 17724 E AndroidRuntime:    at java.lang.Thread.run(Thread.java:920)
03-25 17:24:37.384  3933  3933 E pageboostd: Received HALT command code 2

my app/build.gradle

apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

buildscript {
    repositories {
        gradlePluginPortal()
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.10, 0.99.99]'        
    }
}

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

import com.android.build.OutputFile
def useIntlJsc = false

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
    extraPackagerArgs: [ '--minify=false' ], //Add this!
]

def enableSeparateBuildPerCPUArchitecture = true


def enableProguardInReleaseBuilds = true


def jscFlavor = 'org.webkit:android-jsc:+'


def enableHermes = project.ext.react.get("enableHermes", false)

android {
    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "net.epicmobile.hometips"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 107
        versionName "1.0.7"
        resValue "string", "build_config_package", "net.epicmobile.hometips"
        resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis())
        //flavorDimensions "default"
    }


    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
    
    signingConfigs {
        debug {
             //---
        }
        release {
             //---
        }
    }

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
            //applicationIdSuffix ".debug"
            matchingFallbacks = ['debug', 'release']
            resValue "string", "CodePushDeploymentKey", '"[key]"'
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
             initWith release
             matchingFallbacks = ['release']
            //minifyEnabled true
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            resValue "string", "CodePushDeploymentKey", '"[key]"'
            //resValue "string", "CodePushDeploymentKey", '"[key]"'
        }
        staging{
            resValue "string", "CodePushDeploymentKey", '"[key]"'

                // Note: It is a good idea to provide matchingFallbacks for the new buildType you create to prevent build issues
                // Add the following line if not already there
                matchingFallbacks = ['debug']
        }
        releaseStaging {
            initWith release
            matchingFallbacks = ['release']
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            resValue "string", "CodePushDeploymentKey", '"[key]"'
        }

    }
    
    // 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
            // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
            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 =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }

        }
    }
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation project(':react-native-config')
    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'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    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")
         releaseStagingImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

    if (useIntlJsc) {
        implementation 'org.webkit:android-jsc-intl:+'
    } else {
        implementation 'org.webkit:android-jsc:+'
    }

    implementation platform('com.google.firebase:firebase-bom:28.2.1')
    implementation 'com.google.firebase:firebase-analytics'
   
    //compile project(':react-native-code-push')
}

// 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.envConfigFiles = [
        debug: ".env",
        releasestaging: ".env.staging",
        release: ".env.production",
        production: ".env.production"
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

my package.json

{
    "name": "readysupport",
    "version": "1.0.7",
    "private": true,
    "scripts": {
        "android-dev": "ENVFILE=.env react-native run-android",
        "android-staging": "ENVFILE=.env.staging react-native run-android",
        "android-production": "ENVFILE=.env.production react-native run-android",
        "android-release": "ENVFILE=.env.production react-native run-android --variant=release",
        "ios-dev": "ENVFILE=.env react-native run-ios",
        "ios-staging": "ENVFILE=.env.staging react-native run-ios",
        "ios-production": "ENVFILE=.env.production react-native run-ios",
        "ios": "react-native run-ios",
        "start": "react-native start",
        "test": "jest",
        "lint": "eslint .",
        "postinstall": "rndebugger-open",
        "build:ios": "react-native bundle --entry-file='index.js' --bundle-output='./ios/main.jsbundle' --dev=false --platform='ios'"
    },
    "dependencies": {
        "@actbase/react-daum-postcode": "^1.0.1",
        "@ant-design/react-native": "^4.2.0",
        "@react-native-async-storage/async-storage": "^1.16.0",
        "@react-native-community/cameraroll": "^4.0.4",
        "@react-native-community/checkbox": "^0.5.9",
        "@react-native-community/cli-platform-android": "^7.0.1",
        "@react-native-community/masked-view": "^0.1.11",
        "@react-native-community/picker": "^1.8.1",
        "@react-native-community/segmented-control": "^2.2.2",
        "@react-native-community/slider": "^3.0.3",
        "@react-native-firebase/app": "^14.0.1",
        "@react-native-firebase/auth": "^14.0.1",
        "@react-native-firebase/crashlytics": "^14.0.1",
        "@react-navigation/bottom-tabs": "^6.2.0",
        "@react-navigation/native": "^5.9.4",
        "@react-navigation/stack": "^5.14.5",
        "i18n-js": "^3.8.0",
        "jsc-android": "^250230.2.1",
        "react": "17.0.2",
        "react-loading": "^2.0.3",
        "react-native": "0.63.2",
        "react-native-branch": "^5.0.4",
        "react-native-code-push": "^7.0.4",
        "react-native-config": "^1.4.3",
        "react-native-elements": "^3.4.2",
        "react-native-fbsdk-next": "^4.6.0",
        "react-native-gesture-handler": "^1.10.3",
        "react-native-in-app-review": "^3.3.2",
        "react-native-inappbrowser-reborn": "^3.6.3",
        "react-native-loading-spinner-overlay": "^2.0.0",
        "react-native-local-resource": "^0.1.6",
        "react-native-localize": "^2.1.7",
        "react-native-multiple-select": "^0.5.6",
        "react-native-onesignal": "^4.1.1",
        "react-native-pager-view": "^5.2.1",
        "react-native-parallax-header": "^1.1.4",
        "react-native-picker-select": "^8.0.4",
        "react-native-reanimated": "^2.5.0",
        "react-native-safe-area-context": "^3.2.0",
        "react-native-screens": "^3.4.0",
        "react-native-sectioned-multi-select": "^0.8.1",
        "react-native-select-dropdown": "^1.2.0",
        "react-native-siren": "0.0.4",
        "react-native-snap-carousel": "^3.9.1",
        "react-native-svg": "^12.1.1",
        "react-native-svg-transformer": "^0.14.3",
        "react-native-vector-icons": "^9.0.0",
        "react-native-webview": "^11.13.0",
        "react-redux": "^7.2.4",
        "redux": "^4.1.0",
        "redux-logger": "^3.0.6"
    },
    "devDependencies": {
        "@babel/core": "^7.14.6",
        "@babel/runtime": "^7.14.6",
        "@bam.tech/react-native-make": "^3.0.3",
        "@react-native-community/eslint-config": "^3.0.0",
        "babel-jest": "^27.0.6",
        "eslint": "^7.30.0",
        "jest": "^27.0.6",
        "metro-react-native-babel-preset": "^0.66.1",
        "react-native-debugger-open": "^0.3.25",
        "react-test-renderer": "17.0.1"
    },
    "jest": {
        "preset": "react-native"
    }
}

It's been a week since I faced this problem and I still can't find the cause. please someone save me



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source