question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crash on launch

See original GitHub issue

Description

App is crashing on android after upgrade to latest react-native-screens

Screenshots

image

Steps To Reproduce

  1. Upgrade react native screens from 2.18.1 to latest version and got this isssue

Expected behavior

Latest react native screens working fine on android

Actual behavior

App crash on launching

Reproduction

app/build.gradle

apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format
 *   bundleCommand: "ram-bundle",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
        entryFile: 'index.js',
        enableHermes: true,  // clean and rebuild if changing
]

apply from: '../../node_modules/react-native/react.gradle'
apply from: '../../node_modules/react-native-vector-icons/fonts.gradle'

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = true

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = true

/**
 * The preferred build flavor of JavaScriptCore.
 *
 * For example, to use the international variant, you can use:
 * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
 *
 * The international variant includes ICU i18n library and necessary data
 * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
 * give correct results when using with locales other than en-US.  Note that
 * this variant is about 6MiB larger per architecture than default.
 */
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', false)

/**
 * Architectures to build native code for in debug.
 */
def nativeArchitectures = project.getProperties().get('reactNativeDebugArchitectures')

def billing_version = '4.0.0'

android {
    dexOptions {
        javaMaxHeapSize '3g'
    }

    ndkVersion rootProject.ext.ndkVersion

    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        missingDimensionStrategy 'react-native-camera', 'general'
        missingDimensionStrategy 'store', 'play'
        vectorDrawables.useSupportLibrary = true
        multiDexEnabled true
        applicationId 'com.xxxxxx.community'
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 3205
        versionName '3205.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'
            if (nativeArchitectures) {
                ndk {
                    abiFilters nativeArchitectures.split(',')
                }
            }
        }
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    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
            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 =
                        defaultConfig.versionCode * 1000 + versionCodes.get(abi)
            }
        }
    }

    packagingOptions {
        pickFirst '**/armeabi-v7a/libc++_shared.so'
        pickFirst '**/x86/libc++_shared.so'
        pickFirst '**/arm64-v8a/libc++_shared.so'
        pickFirst '**/x86_64/libc++_shared.so'
        pickFirst '**/x86/libjsc.so'
        pickFirst '**/armeabi-v7a/libjsc.so'
    }
}

configurations.all {
    resolutionStrategy {
        force 'com.facebook.android:facebook-android-sdk:4.22.1'
        force 'com.android.support:support-v4:27.1.0'
    }

    resolutionStrategy.eachDependency { details ->
        def requested = details.requested
        if (requested.group == 'androidx.annotation') {
            details.useVersion '1.0.0'
            exclude group: 'androidx.annotation'
        }

        if (requested.group == 'androidx.arch.core') {
            details.useVersion '2.0.0'
            exclude group: 'androidx.arch.core'
        }
    }
}
dependencies {
    implementation'com.facebook.soloader:soloader:0.10.3+'

    implementation project(':react-native-webview')
    implementation project(':react-native-onesignal')
    implementation project(':react-native-vector-icons')
    implementation project (':react-native-video')
    implementation project(':@react-native-firebase_app')
    implementation project(':@react-native-firebase_analytics')
    implementation project(':react-native-paypal-lib')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-image-crop-picker')
    implementation platform('com.google.firebase:firebase-bom:29.0.3')
    implementation 'com.google.firebase:firebase-messaging:21.1.0'
    implementation 'com.google.firebase:firebase-perf'

    implementation 'com.google.firebase:firebase-crashlytics'
    implementation "com.android.billingclient:billing:$billing_version"
    implementation project(path: ':@react-native-community_cameraroll')
    compile ('com.google.android.gms:play-services-gcm:10.0.1') {
        force = true
    }

    compile 'com.facebook.fresco:fresco:2.5.0'
    implementation 'com.facebook.fresco:animated-gif:2.5.0'
    compile project(':WebRTCModule')
    implementation project(':react-native-maps')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-contacts')
    implementation project(':@react-native-community_async-storage')
    implementation project(':react-native-svg')
    implementation project(':react-native-reanimated')
    compile (project(':react-native-push-notification')) {
        exclude group: 'com.google.android.gms', module: 'play-services-gcm'
        exclude group: 'com.google.firebase'
    }
    implementation 'com.google.android.gms:play-services-gcm:17.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'com.android.support:design:27.1.0'
    implementation (project(':tipsi-stripe'))
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.facebook.react:react-native:+'  // From node_modules
    implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation "androidx.appcompat:appcompat:1.0.0"
    //implementation 'com.android.support:appcompat-v7:29.0.0' //supportLibVersion = 29.0.0
//    implementation 'com.android.support:support-v4:+'

    implementation 'com.android.support:support-v13:28.0.0'

    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 project(':giphyreactnativesdk')
}

// 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'
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'

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

android/build.gradle

buildscript {
    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 30
        // supportLibVersion = "29.0.0"
        androidXAnnotation = "1.1.0"
        androidXBrowser = "1.0.0"
        firebaseVersion = "17.+"
        googlePlayServicesVersion = "16.+"
        androidMapsUtilsVersion = "+"
        kotlinVersion = "+"
        firebaseMessagingVersion = "21.1.0"
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url 'https://plugins.gradle.org/m2/' }
        maven { url 'https://maven.google.com' }

    }
    dependencies {
        classpath('com.android.tools.build:gradle:4.2.2')
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.14.0'
        classpath 'com.google.firebase:perf-plugin:1.4.1'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        // Add jitpack repository (added by tipsi-stripe)
        maven { url "https://jitpack.io" }
        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")
        }
        maven { url 'https://maven.google.com' }
        google()
        jcenter()
      	maven {
      	    url "https://sdks.instabug.com/nexus/repository/instabug-cp"
       	}

      }
}

configurations.all {
    resolutionStrategy {
        force 'com.facebook.android:facebook-android-sdk:4.22.1'
    }
    resolutionStrategy.eachDependency {details ->
        def requested = details.requested
        if (requested.group == 'com.google.android.gms') {
            details.useVersion '12.0.1'
        }
        if (requested.group == 'com.google.firebase') {
            details.useVersion '12.0.1'
        }
    }
}

subprojects {
    afterEvaluate {project ->
        if (project.hasProperty("android")) {
            android {
                compileSdkVersion 29
                buildToolsVersion "29.0.3"
            }
        }
        if (project.name.contains('react-native-image-picker')) {
            buildscript {
                repositories {
                    maven { url "https://dl.bintray.com/android/android-tools/"  }
                    jcenter()
                }
            }
        }
    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}

Platform

  • iOS
  • [x ] Android
  • Web
  • Windows
  • tvOS

Workflow

  • Managed workflow
  • [ x] Bare workflow

Package versions

package version
react-native 0.66.1
@react-navigation/native latest 6.x
@react-navigation/native-stack latest 6.x
react-native-screens 3.13.1
react-native-safe-area-context 3.2.0
react-native-gesture-handler ^1.10.3
react-native-reanimated 2.3.0-beta.3
expo

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
iamvucmscommented, Mar 30, 2022

Hey @WoLewicki. So sorry for late, I’ve just created reproduction of the crash issue in this repo : https://github.com/iamvucms/rn-screens-reproduce-crash-android.

2reactions
iamvucmscommented, Mar 28, 2022

Yes, it’s working on fresh project. Going to reproduce the bug here

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashing immediately on start up after upgrading to iOS12.
Running fine in simulator but crashes in device. No crash logs recorded. In line error shown after launching the app Thread 1: EXC_BAD_ACCESS...
Read more >
9 Fixes for When Your iPhone Apps Keep Crashing
9 Fixes for When Your iPhone Apps Keep Crashing · 1. Check Your Internet Connection · 2. Close and Relaunch the App ·...
Read more >
How to Fix Crashing Apps on iPhone & iPad | OSXDaily
2: Quit and Re-Launch the App. Sometimes the simplest solution to a resolve a crashing application in iOS is to quit the app...
Read more >
How to Fix Crashing Apps on an iPhone or Android?
Poor memory management is one of the most common reasons for app crashes on mobile devices (tip: learn Android Studio Debug with Bugfender),...
Read more >
Why do my apps keep crashing on Android, How to fix it
How to fix apps that keep crashing on Android · 1. Force stop the app · 2. Restart the device · 4. Reinstall...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found