skip to Main Content

I really need some help with my app. I could build my react native app apk successfully with "eas build -p android –profile preview", but the app crashes immediately after installing on the android device. I tried to rebuild the app several times with a brand new expo project and only add a few pages on it, but it still crashes after built.

There is no error or warning, and the app works fine on expo simulators, as well as expo simulator on physical device. It only crashes after built and installed on real devices.

I connected the device to monitor the log with logcat, but I only got the following log, which doesn’t give me any specific clue about the error in my code:

08-23 15:22:29.036  6078  6130 E AndroidRuntime: Process: com.oki.okieventapp, PID: 6078
08-23 15:22:29.055  1173  6146 W ActivityManager: crash : com.oki.okieventapp,10352
08-23 15:22:29.058  1173  1259 W ActivityTaskManager:   Force finishing activity com.oki.okieventapp/.MainActivity

This is my package.json:

{
  "name": "eventapp0828",
  "version": "1.0.0",
  "main": "expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@react-navigation/bottom-tabs": "^6.6.1",
    "@react-navigation/native": "^6.1.17",
    "@react-navigation/native-stack": "^6.9.26",
    "@react-navigation/stack": "^6.3.29",
    "contentful": "^10.8.7",
    "expo": "~51.0.28",
    "expo-status-bar": "~1.12.1",
    "react": "18.2.0",
    "react-native": "0.74.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

This is my app.json:

{
  "expo": {
    "name": "Oki Event App",
    "slug": "eventieapp",
    "version": "1.0.4",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.oki.okieventapp"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/splash.png",
        "backgroundColor": "#ffffff"
      },
      "package": "com.oki.okieventapp",
      "versionCode": 8
    },
    "web": {
      "favicon": "./assets/splash.png"
    }
  }
}

Could anyone help me with this app crash issue please? Thank you in advance!🥹

2

Answers


  1. You can try installing these packages. Your app should work properly in build mode as well.
    react-native-gesture-handler react-native-screens react-native-safe-area-context

    Login or Signup to reply.
  2. i have the same problem but with location, im using expo-location to get the user current location and save it on firebase DB , the app works well with expo go but when i build the apk version and download it to my android device the app crushes when i click the button that trigger the getLocation function, the first run the app asks me for permission, i granted and then it crushes
    //Get Driver home Location
    const getLocation = async () => {
    Keyboard.dismiss()
    setLocationLoading(true)
    try {
    const isAvailable = await Location.hasServicesEnabledAsync();
    if (!isAvailable) {
    createAlert(‘الرجاء تفعيل خدمات الموقع الجغرافي للتطبيق’)
    setLocationLoading(false);
    return;
    }

          let { status } = await Location.requestForegroundPermissionsAsync();
          if (status !== 'granted') {
            createAlert('حدث خطأ اثناء تحديد الموقع. يرجى المحاولة مرة أخرى');
            setLocationLoading(false);
            return;
          }
          console.log('Getting current position...');
          let location = await Location.getCurrentPositionAsync({
            accuracy: Location.Accuracy.High,
          });
          console.log('Location obtained:', location)
          setLocation(location)
    
        } catch (error) {
          createAlert('حدث خطأ اثناء تحديد الموقع. يرجى المحاولة مرة أخرى');
          console.log(error)
        } finally {
          setLocationLoading(false)
        }
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search