0

I have developed a shopping application using React and I pushed the app to TestFlight for testing but when I am opening the app is crashing with no error message. When I am running the app on simulator/emulator is running with no issues.

Same applies to Android, when I am creating APK for the app is not running is showing me "App has stopped" and the app is crashing but it showing me a successful build.

This is my package.json file

{
  "main": "index.js",
  "scripts": {
    "android": "npx react-native run-android",
    "ios": "npx react-native run-ios",
    "web": "expo start --web",
    "start": "npx react-native start"
  },
  "dependencies": {
    "@cocart/cocart-rest-api": "^1.1.0",
    "@fortawesome/fontawesome-svg-core": "^1.2.35",
    "@fortawesome/free-brands-svg-icons": "^5.15.3",
    "@fortawesome/pro-light-svg-icons": "^5.15.3",
    "@fortawesome/pro-regular-svg-icons": "^5.15.3",
    "@fortawesome/pro-solid-svg-icons": "^5.15.3",
    "@fortawesome/react-native-fontawesome": "^0.2.6",
    "@niku/react-native-dropdown-select": "^0.1.1",
    "@react-native-async-storage/async-storage": "^1.15.5",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-firebase/app": "^12.2.0",
    "@react-native-firebase/auth": "^12.2.0",
    "@react-native-firebase/messaging": "^12.1.0",
    "@react-native-picker/picker": "^1.16.3",
    "@react-navigation/bottom-tabs": "^5.11.11",
    "@react-navigation/drawer": "^5.12.5",
    "@react-navigation/native": "^5.9.4",
    "@react-navigation/stack": "^5.14.5",
    "base-64": "^1.0.0",
    "expo": "~41.0.1",
    "expo-splash-screen": "~0.10.2",
    "expo-status-bar": "~1.0.4",
    "expo-updates": "~0.5.4",
    "firebase": "^8.6.8",
    "lodash.filter": "^4.6.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "~0.63.4",
    "react-native-dropdown-menu": "^2.0.0",
    "react-native-easy-rating": "^0.2.1",
    "react-native-fontawesome-pro": "^2.1.0",
    "react-native-gesture-handler": "~1.10.2",
    "react-native-keyboard-aware-scroll-view": "^0.9.4",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-material-dropdown-v2": "^0.11.1",
    "react-native-paper": "^4.9.2",
    "react-native-picker-select": "^8.0.4",
    "react-native-ratings": "^8.1.0",
    "react-native-reanimated": "~2.1.0",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "~3.0.0",
    "react-native-select-dropdown": "^1.0.6",
    "react-native-svg": "^12.1.1",
    "react-native-unimodules": "~0.13.3",
    "react-native-vector-icons": "^8.1.0",
    "react-native-web": "~0.13.12",
    "react-native-woocommerce-api": "^1.8.8",
    "react-number-format": "^4.6.4"
  },
  "devDependencies": {
    "@babel/core": "^7.6.4",
    "@babel/runtime": "7.6.3",
    "babel-jest": "24.9.0",
    "jest": "24.9.0",
    "metro-react-native-babel-preset": "0.56.3",
    "react-test-renderer": "16.8.3"
  },
  "private": true
}

This picture is result of my logcat [![enter image description here][1]][1]

The app is running on emulator but it is showing this error: [![enter image description here][2]][2]

Here is my AndroidManifest.xml file:

  <!-- OPTIONAL PERMISSIONS, REMOVE WHATEVER YOU DO NOT NEED -->
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
  <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
  <uses-permission android:name="android.permission.VIBRATE"/>
  <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
  <!-- These require runtime permissions on M -->
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <!-- END OPTIONAL PERMISSIONS -->
  <application
    android:name=".MainApplication"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:allowBackup="false"
    android:theme="@style/AppTheme"
  >
    <meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="YOUR-APP-URL-HERE"/>
    <meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="YOUR-APP-SDK-VERSION-HERE"/>
    <activity
      android:name=".MainActivity"
      android:label="@string/app_name"
      android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
      android:launchMode="singleTask"
      android:windowSoftInputMode="adjustResize"
      android:theme="@style/Theme.App.SplashScreen"
    >
      <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
      </intent-filter>
    </activity>
    <activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
  </application>
</manifest>```

This is what is showing me when I ran npx react-native run-android --variant=release

[![enter image description here][3]][3]


  [1]: https://i.stack.imgur.com/it16T.png
  [2]: https://i.stack.imgur.com/yqTYL.png
  [3]: https://i.stack.imgur.com/nd8Wk.png
Maryna Azeez
  • 69
  • 3
  • 13

1 Answers1

0

To fix crashes on android & ios do this

To confirm this is the reason run the logcat you should see a error message like this expo-updates must be configured with a valid update URL or scope key

For ios

Open Expo.plist file & add this to replace it with your OTA URL if you did not configure it or don't want OTA to copy-paste the same thing.

<key>EXUpdatesURL</key>
<string>https://example.com</string>

For android

In AndroidManifest.xml add the below code.

<meta-data android:name="expo.modules.updates.EXPO_UPDATE_URL" android:value="YOUR-APP-URL-HERE"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="YOUR-APP-SDK-VERSION-HERE"/>
Rajendran Nadar
  • 4,962
  • 3
  • 30
  • 51