React-native (Signed) release apk keeps crashing in device
If possible use below in different terminal, issue will be showing on that terminal
adb logcat *:E
In my case the issue was the react-native-gesture-handler
. When I checked logs using adb logcat
it was showing the following error
Unsupported top level event type "onGestureHandlerStateChange" dispatched
solved it by doing import 'react-native-gesture-handler'
in root App.js
.
For more info check this
To those wanderers that face the same problem as I did, here's the solution:
i. Go to [ProjectName]/android/app/src/main
(If the directory doesn't contain
index.android.bundle
inside ofassets
folder, as not did mine. Then create a folder name assets. In case the files are present, delete theindex.android.bundle
file only.)
ii. After navigating to your root project directory in your Command Prompt type -
cd android
./gradlew clean
iii. Go back to your root directory in your Command Prompt and type -
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
And it's done. Don't forget to sign your newly build react-native app tho.