4

I'm developing an android app in react native and it is crash when I install it to my android device, my android device is running on android 10.

package.json

{
  "name": "WifiSwitch",
  "version": "0.0.2",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/viewpager": "^5.0.11",
    "@react-navigation/native": "^5.8.10",
    "@react-navigation/stack": "^5.12.8",
    "axios": "^0.21.1",
    "native-base": "^2.15.0",
    "react": "16.13.1",
    "react-native": "^0.65.1",
    "react-native-android-wifi": "^0.0.41",
    "react-native-best-viewpager": "^1.0.4",
    "react-native-gesture-handler": "^1.9.0",
    "react-native-image-picker": "^4.0.6",
    "react-native-reanimated": "^1.13.2",
    "react-native-safe-area-context": "^3.1.9",
    "react-native-screens": "^2.16.1",
    "react-native-tcp-socket": "^4.5.5",
    "react-native-uuid": "^2.0.1",
    "react-native-vector-icons": "^7.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.10",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.17.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "^0.64.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}
lpizzinidev
  • 12,741
  • 2
  • 10
  • 29
Rahul
  • 59
  • 1
  • 4

1 Answers1

3

I recommend you to debug your application using adb logcat

Steps to configure

  1. Connect your device to your computer

  2. Run adb devices to check out if your device is detected. If the command doesn't work because "adb is not a command", go to your ANDROID_HOME path, then open platform-tools

  3. Now run adb logcat: This command will output all logs (debug and error levels) coming from your Android Device.

  4. Install your application again. I recommend you to use react-native run-android. More info: https://reactnative.dev/docs/running-on-device

  5. When your app is going to crash, you will see a Crash Log in the adb logcat output. Search for your app package name. For your convenience, you could as well have a look here to filter only your app: Filter LogCat to get only the messages from My Application in Android?

Whenever you get a crash log, a stack trace is also provided. That can help you trace the issue.

Dharman
  • 30,962
  • 25
  • 85
  • 135
franznkemaka
  • 153
  • 1
  • 1
  • 9