Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN 0.56.0 ANDROID crash on release mode: JSException: Can't find variable: Promise #20062

Closed
3 tasks done
yiky84119 opened this issue Jul 6, 2018 · 1 comment
Closed
3 tasks done
Labels
Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@yiky84119
Copy link

yiky84119 commented Jul 6, 2018

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.5
CPU: x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
Memory: 31.50 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.11.3 - /usr/local/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 19.1.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.2, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.2, 27.0.3
API Levels: 19, 22, 23, 24, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4819257
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.4.1 => 16.4.1
react-native: 0.56.0 => 0.56.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7

Description

update to 0.56.0, when run android on release mode, app crash .
java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Can't find variable: Promise

i just found that, if using promise outside first Component class, on release mode it crash.

// run error: Can't find variable: Promise
let test = Promise.reject(new Error('registerApp required.'));
test.then(() => {
    console.log('test');
});

type Props = {};
export default class App extends Component<Props> {
  constructor(props) {
    super(props);

      // run ok
      // let test = Promise.reject(new Error('registerApp required.'));
      // test.then(() => {
      //     console.log('test');
      // });
  }
  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>
    );
  }
}

Reproducible Demo

https://snack.expo.io/r1tfsO2fX

@react-native-bot react-native-bot added the Platform: Android Android applications. label Jul 6, 2018
@kelset
Copy link
Contributor

kelset commented Jul 6, 2018

Closing this in favour of #19827 since the conversation seems to be moving forward over there

@kelset kelset closed this as completed Jul 6, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Jul 18, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants