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 crashes on launch when building a variant release

See original GitHub issue

After update my project to the latest version of React-Native, the APK start to crash on launch, so I create a new project with the latest version o RN, without any code and simply run the react-native run-android --variant=release and this new project crash on launch PS: i configured the keystore and the variant releases in build.graddle

Environment

React Native version:

  info 
  React Native Environment Info:
    System:
      OS: Linux 5.0 Fedora 29 (Workstation Edition) 29 (Workstation Edition)
    Binaries:
      Node: 11.15.0
      Yarn: 1.16.0
      npm: 6.9.0
    SDKs:
      Android SDK:
        API Levels: 27, 28
        Build Tools: 28.0.3
        System Images: android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
    npmPackages:
      react: 16.8.3 => 16.8.3 
      react-native: 0.59.8 => 0.59.8 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Steps To Reproduce

  1. react-native init foo
  2. Configure the keystore
  3. react-native run-android --variant=release

Expected Behavior

The App should run without any crash or error. App returns BUILD SUCCESS, but crashes without logging any error on start

Code Example

App.js

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';

const instructions = Platform.select({
  ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
  android:
    'Double tap R on your keyboard to reload,\n' +
    'Shake or press menu button for dev menu',
});

type Props = {};
export default class App extends Component<Props> {
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>Welcome to React Native!</Text>
        <Text style={styles.instructions}>To get started, edit App.js</Text>
        <Text style={styles.instructions}>{instructions}</Text>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11

github_iconTop GitHub Comments

8reactions
kylethielkcommented, May 14, 2019

Hi @GianMantuan I just encountered this too.

By chance I remember being prompted by Android Studio to upgrade my Gradle Version earlier in the day.

I reverted my Gradle version and the issue immediately resolved itself. Here are the gradle changes that Android Studio applied:

Screen Shot 2019-05-14 at 11 13 24 AM

Once I reverted this change and re-built the release variant it worked without issue again.

3reactions
kelsetcommented, May 20, 2019

I’ve investigated and yes, I can confirm that the current latest 0.59.x is NOT compatible with Gradle 3.4.0.

But surely 0.60 will, thanks to this commit: https://github.com/facebook/react-native/commit/30348f789946dc99f5ccd02c85c8decbdb9ac29b

We will try to see if we can cherry pick it for the next 0.59.9, but it’s unlikely (you can stay updated here: https://github.com/react-native-community/releases/issues/124).

Please be patient, we are trying to get an 0.60 RC out this week.

(in the meantime I’ll close this since it’s a known limitation already fixed on master)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixing React-Native android release build - wesionaryTEAM
Android release build crashes on launch but works fine in development mode. After months of research and development, your app is finally ready...
Read more >
How to disagnose why React Native app crashes only on ...
Installing the app to a virtual device using npx react-native run-android --variant=release will yield the same result: the app installs without ...
Read more >
React Native Android release build crash on device - Medium
Open a terminal or command prompt and navigate to your project's root folder. And execute command below. It will delete any existing 'index....
Read more >
Troubleshooting build errors and crashes - Expo Documentation
Go to your build details page (find it on the build dashboard if you don't have it open already) and expand any failed...
Read more >
Using Hermes - React Native
npx react-native run-android --variant release ... to bytecode during build time which will improve your app's startup speed on device.
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