skip to Main Content

Problem:

Hey Stackoverflow. Because of internet issues, I was testing my react native app last week only in the web emulator. Now I wanted to try it in the Expo go, mobile emulator. But as soon as I connect to the project and the js is fully built, the whole app crashes without an error message.

What I have tried to fix it:

I now connected my phone to my windows pc and ran this logcat command: adb logcat *:S ReactNative:V ReactNativeJS:V to get the error message this way. But I can’t figure out what the problem is.

The logcat command logs this when I run the app:

10-19 13:54:39.731  9429 11453 I ReactNativeJS: Running "main" with {"initialProps":{"exp":{}},"rootTag":1}
10-19 13:54:39.801  9429 11453 W ReactNativeJS: Constants.installationId has been deprecated in favor of generating and storing your own ID. Implement it using expo-application's androidId on Android and a storage API such as expo-secure-store on iOS and localStorage on the web. This API will be removed in SDK 44.
10-19 13:54:46.209  9429 11682 I ReactNativeJS: Running "main" with {"initialProps":{"exp":{"initialUri":"exp://192.168.1.111:19000","shell":false,"manifestString":"{"name":"productivity","slug":"productivity","version":"1.0.0","orientation":"portrait","icon":".\/assets\/icon.png","splash":{"image":".\/assets\/splash.png","resizeMode":"contain","backgroundColor":"#ffffff","imageUrl":"http:\/\/192.168.1.111:19000\/assets\/.\/assets\/splash.png"},"updates":{"fallbackToCacheTimeout":0},"assetBundlePatterns":["**\/*"],"ios":{"supportsTablet":true},"android":{"adaptiveIcon":{"foregroundImage":".\/assets\/adaptive-icon.png","backgroundColor":"#FFFFFF","foregroundImageUrl":"http:\/\/192.168.1.111:19000\/assets\/.\/assets\/adaptive-icon.png"}},"web":{"favicon":".\/assets\/favicon.png"},"_internal":{"isDebug":false,"projectRoot":"D:\\coding\\apps\\productivity","dynamicConfigPath":null,"staticConfigPath":"D:\\coding\\apps\\productivity\\app.json","packageJsonPath":"D:\\coding\\apps\\productivity\\package.json"},"sdkVersion":"42.0.0","platforms":["ios","android","web"],"developer":{"tool":"expo-cli","projectRoot":"D:\\coding\\apps\\productivity"},"packagerOpts":{"scheme":null,"hostType":"lan","lanType":"ip","devClient":false,"dev":true,"minify":false,"urlRandomness":"2s-g42","https":false},"mainModuleName":"node_modules\\expo\\AppEntry","__flipperHack":"React Native packager is running","debuggerHost":"192.168.1.111:19000","logUrl":"http:\/\/192.168.1.111:19000\/logs","hostUri":"192.168.1.111:19000","bundleUrl":"http:\/\/192.168.1.111:19000\/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&hot=false&minify=false","iconUrl":"http:\/\/192.168.1.111:19000\/assets\/.\/assets\/icon.png","id":"UNVERIFIED-192.168.1.111-productivity","isVerified":true,"primaryColor":"#023C69"}"}},"rootTag":1}

these are my versions if that is important:

  "dependencies": {
    "@babel/preset-env": "^7.15.8",
    "@react-native-async-storage/async-storage": "^1.15.9",
    "@react-native-community/datetimepicker": "^3.5.2",
    "@react-native-community/masked-view": "^0.1.11",
    "async-storage": "^0.1.0",
    "date-fns": "^2.25.0",
    "expo": "^42.0.4",
    "expo-status-bar": "~1.0.4",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz",
    "react-native-color-palette": "^2.2.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-reanimated": "^1.13.1",
    "react-native-screens": "^3.8.0",
    "react-native-svg": "^12.1.1",
    "react-native-vector-icons": "^8.1.0",
    "react-native-web": "~0.13.12",
    "react-navigation": "^4.4.4",
    "react-navigation-drawer": "^2.7.1",
    "react-navigation-stack": "^2.10.4"
  },

I hope you can help me. Feel free to leave a comment with another logcat command that I can run too.

7

Answers


  1. I am not sure if this helps, but I too have been having stability problems with Expo Go. They range from suddenly crashing when I try to run a React Native project from Snack to not getting past the splash screen. I earlier looked at comments of Expo Go on Google Play and found that several people have reported multiple stability issues. While convenient to run RN through Snack online preview, I think I might need to test it via the CLI for my device. I hope that these issues are sorted soon.

    Login or Signup to reply.
  2. In my case. I mistakenly typed "fontStyle" instead of "fontSize". It’s fine in ios but in an android continuous crashes without showing any errors.

    Login or Signup to reply.
  3. In my case, I had a component used a useState hook after first, conditional return:

    function Component() {
    
        // code
    
        if (condition) {
            return <LoadingScreen />
        }
    
        ... //code
    
        const [value, setValue] = useState() // this was causing an error
    
        return <View>
            ... // code
        </View>
    
    }
    

    When I moved the useState to the top of the function, before the first return, the app stopped crashing

    Login or Signup to reply.
  4. It has been a while, but in my case, I was using flex:’33%’ as a style. From experience, if you are using CSS properties that are only supported by the web expo go seems to crash without an error message.

    Login or Signup to reply.
  5. I had the same issue, and it was driving me crazy. In the end this fixed it. In my project directory I ran:

    npm install -g expo-cli
    npx expo-cli upgrade

    I got "You are currently using SDK 47.0.0. Would you like to update to the latest version, 48.0.0?" and answered yes.

    After the update it worked! 🕺

    Login or Signup to reply.
  6. In my case, it was caused because I typed:

    paddingTop: "200px"
    

    instead of:

    paddingTop: 200
    

    Hope it helps.

    Login or Signup to reply.
  7. In my case (android crashing immediately) it was a duplicate entry in the file android/app/src/main/res/xml/network_security_config.xml.

    I found it by opening the android-Folder in android studio and running the app from there. In the Logcat tab I saw the following error:

    2023-04-04 12:12:16.096 13209-13209/com.evolute E/AndroidRuntime: FATAL EXCEPTION: main
        Process: com.myappname, PID: 13209
        java.lang.RuntimeException: Unable to instantiate application com.myappname.MainApplication package com.myappname: java.lang.RuntimeException: Failed to parse XML configuration from network_security_config
    

    Further down in the stacktrace I noticed this line:

    Caused by: android.security.net.config.XmlConfigSource$ParserException: 127.0.0.1 has already been specified at: Binary XML file line #11
    

    removing the duplicates solved it for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search