After upgrading React Native from 0.62 to the 0.66.3, I am encountering an issue when attempting to build the Android release version of my app.I have tried with react native version 0.68.7 version too, but facing same problem, app is working fine in debug mode. This issue is blocking the release of our Android app. Any help or guidance on resolving this issue would be greatly appreciated.

Logcat detail of android studio

FATAL EXCEPTION: mqt_native_modules
Process: com.charlottesnewbornacademy.app, PID: 11233
com.facebook.react.common.JavascriptException: TypeError: Cannot read property 'showErrorDialog' of undefined, js engine: hermes, stack:
anonymous@92:57182
v@2:1473
d@2:945
o@2:413
anonymous@91:50
v@2:1473
d@2:945
o@2:413
anonymous@90:114
v@2:1473
d@2:945
o@2:413
anonymous@89:189
v@2:1473
d@2:945
o@2:413
anonymous@88:52
v@2:1473
d@2:945
o@2:413
anonymous@227:302
v@2:1473
d@2:945
o@2:413
get Animated@8:3173
anonymous@485:2699
v@2:1473
d@2:945
o@2:413
anonymous@473:872
v@2:1473
d@2:945
o@2:413
anonymous@472:240
v@2:1473
d@2:945
o@2:413
anonymous@471:312
v@2:1473
d@2:945
o@2:413
anonymous@510:240
v@2:1473
d@2:945
o@2:413
anonymous@504:320
v@2:1473
d@2:945
o@2:413
anonymous@502:173
v@2:1473
d@2:945
o@2:413
anonymous@500:2170
v@2:1473
d@2:945
o@2:413
anonymous@404:168
v@2:1473
d@2:945
o@2:413
anonymous@394:153
v@2:1473
d@2:945
o@2:413
anonymous@6:57
v@2:1473
d@2:875
o@2:413
global@1202:3
at
com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:83)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
at java.lang.Thread.run(Thread.java:1012)

android/build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "30.0.3"
        minSdkVersion = 24
        compileSdkVersion = 33
        targetSdkVersion = 33
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.1.1")
        classpath 'com.google.gms:google-services:4.3.15'

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

android/app/build.gradle

apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services'
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
import com.android.build.OutputFile

 def getPassword(String currentUser, String keyChain) {
   def stdout = new ByteArrayOutputStream()
   def stderr = new ByteArrayOutputStream()
   exec {
       commandLine 'security', '-q', 'find-generic-password', '-a', currentUser, '-s', keyChain, '-w'
       standardOutput = stdout
       errorOutput = stderr
       ignoreExitValue true
   }
   //noinspection GroovyAssignabilityCheck
      stdout.toString().trim()
}

def pass = getPassword("charlotte","charlotte_android_keystore")

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

apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

def enableSeparateBuildPerCPUArchitecture = false

def enableProguardInReleaseBuilds = false

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

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.charlottesnewbornacademy.app'
        minSdkVersion   24
        targetSdkVersion rootProject.ext.targetSdkVersion
        multiDexEnabled true
        versionCode 151
        versionName '1.5.1'
    }
    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'
        }
        release {
            if (project.hasProperty('CHARLOTTE_UPLOAD_STORE_FILE')) {
                storeFile file(CHARLOTTE_UPLOAD_STORE_FILE)
                storePassword pass
                keyAlias CHARLOTTE_UPLOAD_KEY_ALIAS
                keyPassword pass
            }
            if (project.hasProperty('CHARLOTTE_UPLOAD_STORE_FILE')) {
                storeFile file(CHARLOTTE_UPLOAD_STORE_FILE)
                storePassword pass
                keyAlias CHARLOTTE_UPLOAD_KEY_ALIAS
                keyPassword pass
            }
        }

    }
    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.debug
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    packagingOptions {
        pickFirst "lib/armeabi-v7a/libc++_shared.so"
        pickFirst "lib/arm64-v8a/libc++_shared.so"
        pickFirst "lib/x86/libc++_shared.so"
        pickFirst "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 'com.android.support:multidex:2.0.1'
    implementation fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation ("com.facebook.react:react-native") version {
    strictly "0.66.3"
    } // From node_modules
    implementation platform('org.jetbrains.kotlin:kotlin-bom:1.8.0')
    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
    implementation "androidx.appcompat:appcompat:1.1.0"
    implementation "androidx.exifinterface:exifinterface:1.2.0"
    implementation "androidx.legacy:legacy-support-core-ui:1.0.0"
    implementation "androidx.legacy:legacy-support-core-utils:1.0.0"

    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }
implementation ('com.facebook.fresco:imagepipeline-base:2.5.0') {
    exclude group: 'com.facebook.imagepipeline.cache', module: 'CountingMemoryCacheInspector'
}
implementation 'com.facebook.fresco:stetho:2.5.0'

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

// 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.implementation
    into 'libs'
}

configurations.all {
     resolutionStrategy {
       force "com.facebook.soloader:soloader:0.10.5+"
     }
}

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

React Native Version:0.66.3

Output of npx react-native info

System:
OS: macOS 13.3.1
CPU: (8) arm64 Apple M2
Memory: 106.67 MB / 8.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.20.2 - ~/.nvm/versions/node/v16.20.2/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.19.4 - ~/.nvm/versions/node/v16.20.2/bin/npm
Watchman: 2023.10.02.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode: 14.3/14E222b - /usr/bin/xcodebuild
Languages:
Java: 17.0.8.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.66.3 => 0.66.3
react-native-macos: Not Found

Steps to reproduce Run command: cd android && ./gradlew bundleRelease && cd ../ && react-native run-android --variant=release

0

There are 0 answers