expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
34.24k stars 5.48k forks source link

Expo Dev Client + Android 10 + stripe-react-native 0.6.1 crash on startup before even showing dev menu (Unable to start activity ComponentInfo: java.lang.NullPointerException) #17660

Closed koukoujohn closed 2 years ago

koukoujohn commented 2 years ago

Summary

Dev app builds with no issues for Android but crashes immediately on Android 10 device on load without even having the chance to show the dev menu.

I know this is a very specific error, has anyone seen this error below before? Or has a suggestion for a config plugin that would temporarily fix it

Managed or bare workflow? If you have made manual changes inside of the ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

Package versions

"@eva-design/eva": "2.0.0", "@expo/react-native-action-sheet": "^3.6.0", "@intercom/intercom-react-native": "^3.0.3", "@react-native-async-storage/async-storage": "~1.17.3", "@react-native-community/masked-view": "0.1.10", "@react-native-community/netinfo": "8.2.0", "@sentry/react-native": "^3.4.2", "@stripe/stripe-react-native": "0.6.1", "@ui-kitten/components": "^5.1.0", "@ui-kitten/eva-icons": "^5.0.0", "apisauce": "^1.0.2", "config-plugin-react-native-intercom": "^1.4.0", "expo": "^45.0.4", "expo-apple-authentication": "~4.2.1", "expo-application": "~4.1.0", "expo-asset": "~8.5.0", "expo-auth-session": "~3.6.1", "expo-blur": "~11.1.0", "expo-clipboard": "~3.0.1", "expo-constants": "~13.1.1", "expo-dev-client": "~0.9.6", "expo-device": "~4.2.0", "expo-firebase-analytics": "~7.0.0", "expo-firebase-core": "~5.0.0", "expo-font": "~10.1.0", "expo-intent-launcher": "~10.2.0", "expo-linear-gradient": "~11.3.0", "expo-linking": "~3.1.0", "expo-localization": "~13.0.0", "expo-location": "~14.2.2", "expo-notifications": "~0.15.2", "expo-permissions": "~13.2.0", "expo-random": "~12.2.0", "expo-splash-screen": "~0.15.1", "expo-status-bar": "~1.3.0", "expo-system-ui": "~1.2.0", "expo-updates": "~0.13.1", "formik": "^1.5.7", "geolib": "^3.3.3", "i18next": "^19.5.0", "lodash": "^4.17.11", "lottie-react-native": "5.0.1", "memoizee": "^0.4.14", "moment": "^2.27.0", "numeral": "^2.0.6", "react": "17.0.2", "react-content-loader": "^6.0.3", "react-dom": "17.0.2", "react-i18next": "^11.7.0", "react-native": "0.68.2", "react-native-animatable": "^1.3.2", "react-native-big-list": "^1.4.3", "react-native-console-time-polyfill": "^1.2.1", "react-native-country-picker-modal": "^2.0.0", "react-native-easy-toast": "^1.2.0", "react-native-eva-icons": "^1.1.0", "react-native-fast-image": "^8.5.11", "react-native-formik": "^1.7.6", "react-native-gesture-handler": "~2.2.1", "react-native-image-zoom-viewer": "^3.0.1", "react-native-keyboard-aware-scroll-view": "^0.9.1", "react-native-maps": "0.30.2", "react-native-modal": "^13.0.0", "react-native-paper": "^2.16.0", "react-native-reanimated": "~2.8.0", "react-native-redash": "^16.2.2", "react-native-safe-area-context": "4.2.4", "react-native-screens": "~3.11.1", "react-native-svg": "12.3.0", "react-native-tab-view": "^2.16.0", "react-native-web": "0.17.7", "react-native-webview": "11.18.1", "react-navigation": "^4.4.4", "react-navigation-drawer": "^2.7.0", "react-navigation-stack": "^2.10.4", "react-navigation-tabs": "^2.11.0", "react-redux": "^7.1.0", "recompose": "^0.30.0", "redux": "^4.0.5", "redux-saga": "^1.0.5", "seamless-immutable": "^7.1.4", "sentry-expo": "^4.2.0", "socket.io-client": "^2.2.0", "uuid": "^3.4.0", "yup": "^0.27.0"

Environment

EAS CLI 0.52.0 environment info: System: OS: Windows 10 10.0.19044 Binaries: Node: 14.17.6 - C:\Program Files\nodejs\node.EXE npm: 6.14.15 - C:\Program Files\nodejs\npm.CMD Utilities: Git: 2.33.0. - /mingw64/bin/git npmPackages: expo: ^45.0.4 => 45.0.4 expo-dev-client: ~0.9.6 => 0.9.6 expo-updates: ~0.13.1 => 0.13.1 react: 17.0.2 => 17.0.2 react-dom: 17.0.2 => 17.0.2 react-native: 0.68.2 => 0.68.2 react-native-web: 0.17.7 => 0.17.7 react-navigation: ^4.4.4 => 4.4.4 Project workflow: managed

Reproducible demo

I can't reproduce it on a clean app with stripe-react-native and latest expo-dev-client.

I think the crash is caused by a combination of stripe react native 0.6.1 and one of the other dependencies.

So a reproducible example is to just create an expo dev client app with the dependencies above and run it on Android 10(device/emulator)

Stacktrace (if a crash is involved)

2022-05-21 12:20:53.105 30836-30836/com.my-app E/AndroidRuntime: FATAL EXCEPTION: main Process: com.my-app, PID: 30836 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my-app/expo.modules.devlauncher.launcher.errors.DevLauncherErrorActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4060) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4247) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2613) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8668) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109) Caused by: java.lang.NullPointerException at expo.modules.devlauncher.launcher.errors.DevLauncherErrorActivity.onCreate(DevLauncherErrorActivity.kt:31) at android.app.Activity.performCreate(Activity.java:8214) at android.app.Activity.performCreate(Activity.java:8202) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1320) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4033) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4247) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:91) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:149) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:103) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2613) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:219) at android.app.ActivityThread.main(ActivityThread.java:8668) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1109)

ajsmth commented 2 years ago

It would be helpful if you could provide a reproduction that I could clone and try on my end - your description makes it look like it could very well be a bug in dev-client

SrBrahma commented 2 years ago

Same issue, and I do also have Stripe and Sentry. Just upgraded to SDK 45, EAS.

I open the dev client app, and it crashes even before showing up the menu. Never had it before.

I will try to remove Sentry and build again, but Stripe could also be causing it.

I hadn't Sentry before the SDK 45 upgrade.

I had an issue with Stripe >=0.2.4 when I used SDK 44: https://forums.expo.dev/t/change-targetsdkversion-for-stripe-react-native-0-2-4/62534/6?u=srbrahma, maybe it and/or other related issues haven't been fixed in SDK 45.

My package.json:

```json "dependencies": { "@ahive/shared": "workspace:^", "@babel/runtime": "7.17.7", "@expo-google-fonts/dm-sans": "0.2.2", "@expo-google-fonts/inter": "0.2.2", "@expo-google-fonts/mada": "^0.2.2", "@expo-google-fonts/roboto": "0.2.2", "@expo/vector-icons": "^13.0.0", "@react-native-async-storage/async-storage": "~1.17.3", "@react-native-community/datetimepicker": "6.1.2", "@react-native-community/netinfo": "8.2.0", "@react-navigation/bottom-tabs": "6.3.1", "@react-navigation/material-top-tabs": "6.2.1", "@react-navigation/native": "^6.0.10", "@react-navigation/stack": "6.2.1", "@sentry/react-native": "^3.4.2", "@sindresorhus/is": "4.6.0", "@stripe/stripe-react-native": "0.6.1", "@typesaurus/react": "5.0.0-alpha.4", "compare-versions": "^4.1.3", "dayjs": "1.11.1", "expo": "^45.0.4", "expo-app-loading": "~2.0.0", "expo-application": "~4.1.0", "expo-auth-session": "~3.6.1", "expo-constants": "~13.1.1", "expo-dev-client": "~0.9.6", "expo-device": "~4.2.0", "expo-font-loader": "1.0.0", "expo-image-picker": "~13.1.1", "expo-mail-composer": "~11.2.0", "expo-navigation-bar": "~1.2.0", "expo-notifications": "~0.15.2", "expo-random": "~12.2.0", "expo-screen-capture": "^4.2.0", "expo-status-bar": "~1.3.0", "expo-system-ui": "~1.2.0", "expo-updates": "~0.13.1", "firebase": "8.10.1", "firebase-functions-extended-client": "5.5.1", "lodash": "4.17.21", "pagescrollview": "1.3.2", "react": "17.0.2", "react-dom": "17.0.2", "react-hook-form": "7.31.3", "react-hooks-global-state": "1.0.2", "react-native": "0.68.2", "react-native-bouncy-checkbox": "2.1.10", "react-native-bouncy-checkbox-group": "npm:react-native-bouncy-checkbox-group-srbrahma@0.1.1", "react-native-dialog": "9.2.1", "react-native-draggable-flatlist": "3.1.1", "react-native-gesture-handler": "~2.2.1", "react-native-gev": "^0.50.0", "react-native-mask-text": "0.7.0", "react-native-modal-datetime-picker": "10.2.0", "react-native-pager-view": "5.4.15", "react-native-payment-icons": "1.0.11", "react-native-reanimated": "~2.8.0", "react-native-safe-area-context": "4.2.4", "react-native-screens": "~3.11.1", "react-native-shadow-2": "6.0.5", "react-native-size-matters": "0.4.0", "react-native-svg": "12.3.0", "react-native-tab-view": "3.1.1", "react-native-web": "0.17.7", "react-query": "^3.39.1", "sentry-expo": "^4.2.0", "ts-retry-promise": "0.6.1", "typesaurus": "npm:typesaurus-srbrahma@^1.0.0" }, "devDependencies": { "@babel/core": "^7.12.9", "@babel/preset-typescript": "^7.16.7", "@types/async-retry": "^1.4.4", "@types/deep-equal": "^1.0.1", "@types/lodash": "^4.14.182", "@types/react": "~17.0.21", "@types/react-native": "~0.67.6", "@types/react-router-native": "^5.1.3", "babel": "^6.23.0", "babel-core": "^6.26.3", "babel-loader": "^8.2.4", "babel-plugin-module-resolver": "4.1.0", "eas-cli": "^0.53.0", "eslint-config-gev": "^2.33.0", "expo-cli": "5.4.8", "typescript": "~4.7.2" }, ```

Edit1: Removing Sentry didn't fix it. Tomorrow will downgrade Stripe and try again.

Edit2: Downgraded Stripe to 0.2.3 and it's now working. @ajsmth take a look into the link I mentioned here.

koukoujohn commented 2 years ago

@ajsmth I'm sorry but I can't provide a better repro than: create an expo dev client build with my dependencies listed above and test on an Android 10 device/emulator. I haven't found what combination of dependencies is causing this crash on dev app start yet.

I have a suspicion that also reanimated/gesturehandler is involved in the crash along with Stripe.

I am saying that because when the app tries to open, I see an animation like react navigation is trying to open a new screen(!!) multiple times but it fails. And then the app crashes completely after a few seconds. Sometimes it crashes immediately.

But the error is always the same from stacktrace:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my-app/expo.modules.devlauncher.launcher.errors.DevLauncherErrorActivity}: java.lang.NullPointerException

expo-bot commented 2 years ago

Hi there! It looks like your issue requires a minimal reproducible example, but it is invalid or absent. Please prepare such an example and share it in a new issue.

The best way to get attention to your issue is to provide a clean and easy way for a developer to reproduce the issue on their own machine. Please do not provide your entire project, or a project with more code than is necessary to reproduce the issue.

A side benefit of going through the process of narrowing down the minimal amount of code needed to reproduce the issue is that you may get lucky and discover that the bug is due to a mistake in your application code that you can quickly fix on your own.

Resources