React-native: Release app crashing

Created on 18 Apr 2019  ·  27Comments  ·  Source: facebook/react-native

🐛 Bug Report

App is crashing in the release mode, it works perfectly in dev mode.

To Reproduce

react-native run-android --variant=release

output of crash log
04-18 15:05:48.515 13278 13294 E AndroidRuntime: FATAL EXCEPTION: create_react_context
04-18 15:05:48.515 13278 13294 E AndroidRuntime: Process: com.lms, PID: 13278
04-18 15:05:48.515 13278 13294 E AndroidRuntime: java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:218)
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:31)
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:247)
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1152)
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:123)
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:943)
04-18 15:05:48.515 13278 13294 E AndroidRuntime: at java.lang.Thread.run(Thread.java:764)

Environment

React Native Environment Info:
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: (4) x64 Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
Memory: 1.34 GB / 15.37 GB
Shell: 5.4.2 - /bin/zsh
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
Yarn: 1.7.0 - /usr/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
SDKs:
Android SDK:
API Levels: 23, 25, 26, 27, 28
Build Tools: 26.0.2, 26.0.3, 27.0.3, 28.0.3
System Images: android-28 | Google APIs Intel x86 Atom
npmPackages:
react: 16.8.3 => 16.8.3
react-native: 0.59.4 => 0.59.4

Bug Linux Locked

Most helpful comment

can you comment this line from: "../../node_modules/react-native/react.gradle" and try react bundle command with full path of index.js file

All 27 comments

this worked for me.

curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

Same here!

This is not my first version; I have already published my app, but some how it stop working and only for releases.

2019-05-14 07:54:56.065 6616-6663/com.app E/unknown:ReactNative: Exception in native call
    java.lang.RuntimeException: Unable to load script. Make sure you're either running a Metro server (run 'react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
        at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:218)
        at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:31)
        at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:247)
        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1152)
        at com.facebook.react.ReactInstanceManager.access$900(ReactInstanceManager.java:123)
        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:943)
        at java.lang.Thread.run(Thread.java:761)

Running the follow command, also does not work.

react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res

Again, react-native run-android works fine. But when I try run from Android Studio (Run or Debug button) or when I try do create a new SDK (Build > Generate Signed Bundle / SDK) for upload it does not work.

"react": "16.6.3",
"react-native": "^0.59.8",

@rochapablo Do you have bundle file in android/app/src/main/assets

@hariegnify, android/app/src/main/assets does not have any bundle file, not even when the app is running from react-native run-android command.

what this(react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res) command resulting, can you able to create bundle through it.

@hariegnify, indeed through this command I should have the bundle file, but nothing happens.

@rochapablo any error you are getting?, If you face any issue like index.js/index.android.js not found give, the absolute path(for linux - /home/{user}/project-dir) of index.js file and output file.

@hedgerwang no errors besides the main one.

If I'm right, RN new versions only read index.js

project.ext.react = [
    entryFile: "index.js"
]

Any other line related to index.android.js it's commented by default RN setup when build new app project.

@rochapablo can you share app/build.gradle file

@hariegnify,

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

apply plugin: "com.android.application"

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",
 *
 *   // 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"
]

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

project.ext.envConfigFiles = [
  debug: ".env",
  release: ".env.production"
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

apply plugin: 'io.fabric'
repositories {
  maven { url 'https://maven.fabric.io/public' }
}

/**
 * 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 = false

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

android {
    compileSdkVersion rootProject.ext.compileSdkVersion

    defaultConfig {
        applicationId "com.app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 38
        versionName "0.1.38"

        // Enabling multidex support.
        multiDexEnabled true
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a"
        }
    }
    buildTypes {
        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:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3]
            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 project(':react-native-onesignal')
    implementation project(':react-native-reanimated')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-splash-screen')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-firebase')
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.2'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'
    implementation project(':react-native-fast-image')
    implementation project(':react-native-config')
    implementation(project(':react-native-admob')) {
        exclude group: "com.google.android.gms", module: "play-services-ads"
    }
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.5@aar') {
        transitive = true;
    }
    // implementation "br.com.hands.mdm.libs.android:mdm-bundle:3.3.0"
}

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

apply plugin: 'com.google.gms.google-services'
// The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[15.0.1,15.0.1]], but resolves to 16.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

can you comment this line from: "../../node_modules/react-native/react.gradle" and try react bundle command with full path of index.js file

@hariegnify, wow! it seems to work.

$ react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Loading dependency graph, done.
Loading dependency graph...info Writing bundle output to:, android/app/src/main/assets/index.android.bundle
info Done writing bundle output
info Copying 11 asset files
info Done copying assets

Running from Android Studio, worked. I'm creating a new release...

@hariegnify, release worked! Thank you.

Hi,

Am I suppose to be able to do

react-native run-android --variant=release on my physical android device connected to my machine after the do the following?

$ react-native bundle --dev false --platform android --entry-file index.js --bundle-output ./android/app/build/intermediates/assets/debug/index.android.bundle --assets-dest ./android/app/build/intermediates/res/merged/debug
Loading dependency graph, done.
Loading dependency graph...info Writing bundle output to:, ./android/app/build/intermediates/assets/debug/index.android.bundle
info Done writing bundle output
info Copying 13 asset files
info Done copying assets
✨ Done in 4.28s.

When I try to run the release app on my device I get the above error. Seems the release build is looking for metro, should it be?

Will there be something released so that we don't have to use this workaround soon?

can you comment this line from: "../../node_modules/react-native/react.gradle" and try react bundle command with full path of index.js file

Which line in react.gradle file?

@hariegnify Wow! You saved me hours of frustration! Thanks!

@spyr0s comment the react.gradle line in app gradle

@ShaMan123 can you share you gradle file?

There's some tweaks put because of various deps.
As mentioned this disables bundling so you need to call the command yourself:

what this(react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res) command resulting, can you able to create bundle through it.

apply plugin: "com.android.application"
apply plugin: "com.google.firebase.firebase-perf"
apply plugin: "io.fabric"

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",
 *
 *   // 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",
        //bundleAssetName: "index.android.bundle",
        //bundleInAlpha: true,
        //bundleInBeta: true,
        //jsBundleDirRelease: "$buildDir/intermediates/merged_assets/release/mergeReleaseAssets/out"
]

//  lastest from firebase https://firebase.google.com/support/release-notes/android#20180523
//  latest from firebase-react-native https://github.com/invertase/react-native-firebase/blob/master/docs/variables.yaml
project.ext.firebase = [
        analytics: "16.4.0",
        auth: "16.2.1",
        core: "16.0.8",
        config: "16.5.0",
        crashlytics: "2.9.5",
        database: "16.1.0",
        dynamicLinks: "16.1.8",
        firestore: "18.2.0",
        functions: "16.3.0",
        invites: "16.1.1",
        messaging: "17.5.0",
        perf: "16.2.5",
        storage: "16.1.0",
        ShortcutBadger: "1.1.21"
]

project.ext.androidGms = [
    playServicesBase: "16.1.0",
    playServicesAuth: "16.0.1"
]

//  https://github.com/react-native-community/jsc-android-buildscripts
project.ext.versionControl = [
        JSCAndroid: "r241213"
]

//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    //false by default
def generateUniversalApk = true //false by default

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

android {
    signingConfigs {
        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
            }
        }
    }
    compileSdkVersion rootProject.ext.compileSdkVersion
    /*
    configurations.all {
        resolutionStrategy {
            force 'com.android.support:support-v4:$rootProject.ext.buildToolsVersion'
            force 'com.android.support:design:$rootProject.ext.buildToolsVersion'
        }
    }
*/
    defaultConfig {
        applicationId "AppName"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57"
        versionCode rootProject.ext.versionCode
        versionName rootProject.ext.versionName
        multiDexEnabled true
        vectorDrawables.useSupportLibrary true
        signingConfig signingConfigs.release

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        testInstrumentationRunnerArguments clearPackageData: 'true'
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    splits {
        abi {
            enable enableSeparateBuildPerCPUArchitecture
            universalApk generateUniversalApk  // If true, also generate a universal APK
            reset()
            include "armeabi-v7a", "x86", "x86_64", "arm64-v8a"
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            //if buggy: https://github.com/invertase/react-native-firebase/issues/1004
        }
        debug {
            debuggable true
            minifyEnabled false
            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:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            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
            }
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
        preDexLibraries false
    }
    productFlavors {
    }

    testOptions {
        execution 'ANDROIDX_TEST_ORCHESTRATOR'
    }

    packagingOptions {
        pickFirst '**/libjsc.so'
        pickFirst '**/libc++_shared.so'
    }
}
/*
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support' && requested.name != 'multidex') {
            details.useVersion "${rootProject.ext.supportLibVersion}"
        }
    }
}
*/

configurations.all {
    resolutionStrategy {
        force 'org.webkit:android-jsc:+'
        force 'com.android.support:support-v4:27.1.1'
    }
}

dependencies {
    implementation project(':react-native-fast-image')
    implementation project(':@react-native-community_async-storage')
    implementation "org.webkit:android-jsc:${project.ext.versionControl.JSCAndroid}"
    implementation project(':react-native-webview')
    implementation project(':react-native-gesture-handler')
    implementation project(':react-native-image-crop-picker')
    implementation project(path: ':react-native-sketch-canvas')
    implementation project(path: ':react-native-math-view')
    implementation project(':react-native-vector-icons')
    implementation project(':react-native-view-overflow')
    implementation project(':react-native-localization')
    implementation project(':react-native-linear-gradient')
    implementation project(':react-native-navigation')
    implementation(project(':react-native-google-signin')) {
        exclude group: "com.google.android.gms" // very important
    }
    implementation(project(':react-native-firebase')) {
        transitive = false
    }
    implementation "com.google.android.gms:play-services-base:${project.ext.androidGms.playServicesBase}"
    implementation "com.google.firebase:firebase-core:${project.ext.firebase.core}"
    implementation "com.google.firebase:firebase-config:${project.ext.firebase.config}"
    implementation "com.google.firebase:firebase-analytics:${project.ext.firebase.analytics}"
    implementation "com.google.firebase:firebase-auth:${project.ext.firebase.auth}"
    implementation "com.google.firebase:firebase-firestore:${project.ext.firebase.firestore}"
    implementation "com.google.firebase:firebase-functions:${project.ext.firebase.functions}"
    implementation "com.google.firebase:firebase-messaging:${project.ext.firebase.messaging}"
    implementation "me.leolin:ShortcutBadger:${project.ext.firebase.ShortcutBadger}@aar"  // <-- Add this line if you wish to use badge on Android
    implementation "com.google.firebase:firebase-database:${project.ext.firebase.database}"
    implementation "com.google.firebase:firebase-dynamic-links:${project.ext.firebase.dynamicLinks}"
    implementation "com.google.firebase:firebase-invites:${project.ext.firebase.invites}"
    implementation "com.google.firebase:firebase-storage:${project.ext.firebase.storage}"
    implementation "com.google.firebase:firebase-perf:${project.ext.firebase.perf}"
    implementation("com.crashlytics.sdk.android:crashlytics:${project.ext.firebase.crashlytics}@aar") {
        transitive = true
    }

    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
    implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
// manage a dex bug: https://stackoverflow.com/questions/48249633/errorcannot-fit-requested-classes-in-a-single-dex-file-try-supplying-a-main-dex
    implementation "com.android.support:multidex:1.0.3"

    implementation 'com.facebook.react:react-native:+'
    implementation "com.google.android.gms:play-services-auth:${project.ext.androidGms.playServicesAuth}"

    androidTestImplementation 'androidx.test:runner:1.1.0'
    androidTestUtil 'androidx.test:orchestrator:1.1.0'
}

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

apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true

@ShaMan123, we have different build and deploy processes. I reverse the gradle plug in from 3.4.1 to 3.1.3 and Gradle version to 4.9. Everything works as expected. Thank you

@hariegnify Works for me, thanks!

can you comment this line from: "../../node_modules/react-native/react.gradle" and try react bundle command with full path of index.js file

Works for me as well, but I don't quite get yet why.

@hariegnify Thank you. 🙏🏽

can you comment this line from: "../../node_modules/react-native/react.gradle" and try react bundle command with full path of index.js file

It works, you save my day, thanks 👍

@hariegnify
following are the solutions i have tried...
curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

then tried react-bundle command and also with removing the line apply from "../../node_modules/react-native/react.gradle"

Still when running react-native run-android --variant=release the app crashes as soon as it is opened... trying this on and on for last two day :(

the only thing i find in log cat is
2019-08-10 20:59:29.296 3853-3959/? E/WindowManager: win=Window{711bf74 u0 Splash Screen com.orbstick.connect EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:870 com.android.server.wm.AppWindowToken.destroySurfaces:851 com.android.server.wm.WindowState.onExitAnimationDone:5399 com.android.server.wm.WindowStateAnimator.onAnimationFinished:319 com.android.server.wm.WindowState.onAnimationFinished:5821 com.android.server.wm.-$$Lambda$yVRF8YoeNdTa8GR1wDStVsHu8xM.run:2 com.android.server.wm.SurfaceAnimator.lambda$getFinishedCallback$0:97

how could i debug the error causing the crash?

got it! instead of index.android.bundle i had to rename it to app.bundle maybe its because i am using 0.59.3 react-native version

Was this page helpful?
0 / 5 - 0 ratings