0

React native app is working fine in android emulator and web, but app crashes, just after opening in real android device.

This is package.json

{
  "name": "mytodoapp",
  "version": "1.0.0",
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/webpack-config": "^0.17.4",
    "@react-navigation/drawer": "^6.5.7",
    "@react-navigation/native": "^6.1.2",
    "@react-navigation/native-stack": "^6.9.8",
    "axios": "^1.2.3",
    "expo": "~47.0.13",
    "expo-app-loading": "^2.1.1",
    "expo-cli": "^6.1.0",
    "expo-font": "~11.0.1",
    "expo-status-bar": "~1.4.2",
    "formik": "^2.2.9",
    "moment": "^2.29.4",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "react-native": "0.70.5",
    "react-native-calendars": "^1.1293.0",
    "react-native-paper": "^5.1.4",
    "react-native-web": "~0.18.10",
    "react-navigation": "^4.4.4"
  },
  "devDependencies": {
    "@babel/core": "^7.20.12"
  },
  "private": true
}

This is eas.json

{
  "build": {
    "preview": {
      "android": {
        "buildType": "apk"
      }
    },
    "preview2": {
      "android": {
        "gradleCommand": ":app:assembleRelease"
      }
    },
    "preview3": {
      "developmentClient": true
    },
    "production": {}
  }
}

This is app.json

    {
      "expo": {
        "name": "mytodoapp",
        "slug": "mytodoapp",
        "version": "1.0.0",
        "orientation": "portrait",
        "icon": "./assets/icon.png",
        "userInterfaceStyle": "light",
        "splash": {
          "image": "./assets/splash.png",
          "resizeMode": "contain",
          "backgroundColor": "#ffffff"
        },
        "updates": {
          "fallbackToCacheTimeout": 0
        },
        "assetBundlePatterns": [
          "**/*"
        ],
        "ios": {
          "supportsTablet": true
        },
        "android": {
          "adaptiveIcon": {
            "foregroundImage": "./assets/adaptive-icon.png",
            "backgroundColor": "#FFFFFF"
          },
          "package": "com.hanudas.mytodoapp"
        },
        "web": {
          "favicon": "./assets/favicon.png"
        },
        "extra": {
          "eas": {
            "projectId": "b5bb265d-679e-4a9b-b6d5-0b4089aa554f"
          }
        }
      }
    }

Please guide me, why this app is crashing on installing in real android device. Thank you in advance. Please let me know if you need github link.

  • Did you have any error messages on the terminal when this happens? – marcelofreires Jan 26 '23 at 02:50
  • see here may be this will help you https://stackoverflow.com/questions/43118868/android-studio-app-crashes-on-real-device-but-works-on-emulator –  Jan 26 '23 at 04:45
  • @marcelofreires no error message is shown on terminal. App is working fine on android emulator and on web. It's crashing only when , running on real device – Saurabh Gupta Jan 26 '23 at 05:49
  • @GattuPatel how to log error for react native app, when running on real android device – Saurabh Gupta Jan 26 '23 at 05:50
  • you can check error in android studio logcat – Mahammad Momin Jan 26 '23 at 08:44
  • go to console window and press D then in your device open one Menu and in Menu click debug option it will navigate to chrome then you press right click and inspect then see your log @SaurabhGupta –  Jan 26 '23 at 18:34

0 Answers0