I made a react app and it was working fine using the expo app to test it. I built in for production and on my phone I found it would open once and crash every other time if it would open after building. (I am using android 13) I sent it to a friend using android 11 and it works perfectly. I believe the problem is with one of the packages I am using.
So I have changed and some of the packages and added information in the app.json
file as I have seen on other stackoverflow posts but have not had any luck.
app.json
{
"expo": {
"name": "Finder",
"slug": "finder",
"version": "2.3.1",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "apple.spoonfinder.ml"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.im_the_tea_drinker.spoon_finder"
},
"web": {
"favicon": "./assets/icon.png"
},
"extra": {
"eas": {
"projectId": "2f14cfae-f990-4aab-9d8e-ca06ea8bec1d"
}
}
}
}
These are the packages that I am using
{
"name": "finder",
"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": "~47.0.8",
"expo-cli": "^6.0.8",
"expo-location": "~15.0.1",
"expo-permissions": "~14.0.0",
"expo-sensors": "~12.0.1",
"expo-status-bar": "~1.4.2",
"geolib": "^3.3.3",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-native": "0.70.5"
},
"devDependencies": {
"@babel/core": "^7.19.3"
},
"private": true
}
Does any one know what could be causing this and how I can fix it?
4
Answers
So the problem was the expo sensor functions were some times returning undefined, to all we had to do is check if it was true. This was the fix.
this is an issue with your xml file. you have to set exported property to true. this is an example of react-native cli. you have to do it with expo. I don’t know much about expo.
Put this in manifest of Android Project.
<manifest ...> <uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" /> </manisfest>
And Build again.
app/build.gradle
And Build again