Hi,
My application works fine on Expo Go, both inside iPhone 13 Simulator on Mac and Android phone. But when I convert it into .apk and run it on Android phone, it crashes. Pls help.
package.json-> "dependencies": {
"@react-native-async-storage/async-storage": "^1.17.11",
"@react-native-community/netinfo": "8.2.0",
"@react-navigation/native": "^6.0.14",
"@react-navigation/native-stack": "^6.9.2",
"buffer": "^6.0.3",
"expo": "^45.0.0",
"expo-checkbox": "~2.1.0",
"expo-device": "~4.2.0",
"expo-navigation-bar": "~1.2.0",
"expo-notifications": "~0.15.4",
"expo-status-bar": "~1.3.0",
"lodash": "^4.17.21",
"mqtt": "^4.3.7",
"native-base": "3.4.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-gesture-handler": "~2.2.1",
"react-native-get-random-values": "^1.8.0",
"react-native-safe-area-context": "4.2.4",
"react-native-svg": "12.3.0",
"react-native-web": "0.17.7"
}
Using “eas build -p android --profile preview” to build the apk.
eas.json-> "preview": {
"distribution": "internal",
"ios": {
"buildConfiguration": "Debug",
"image" : "macos-monterey-12.3-xcode-13.3"
},
"android": {
"buildType": "apk"
}
}
App.js
import * as React from "react";
import { Button, View, Text } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { LogBox } from "react-native";
LogBox.ignoreAllLogs();
LogBox.ignoreLogs([
"VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality - use another VirtualizedList-backed container instead.",
"Possible Unhandled Promise Rejection (id: 0):",
"Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`",
"Task orphaned for request <NSMutableURLRequest",
"Can't perform a React state update on an unmounted component",
]);
function HomeScreen({ navigation }) {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>Home Screen</Text>
<Button
title="Go to Details"
onPress={() => navigation.navigate("DetailsScreen")}
/>
</View>
);
}
function DetailsScreen({ navigation }) {
return (
<View style={{ flex: 1, alignItems: "center", justifyContent: "center" }}>
<Text>Details Screen</Text>
<Button
title="Go to Home"
onPress={() => navigation.navigate("HomeScreen")}
/>
</View>
);
}
const Stack = createNativeStackNavigator();
function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="HomeScreen">
<Stack.Screen name="DetailsScreen" component={DetailsScreen} />
<Stack.Screen name="HomeScreen" component={HomeScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;
app.json->"expo": {
"name": "abc",
"slug": "abc",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#fde047"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/icon.png",
"backgroundColor": "#fde047"
},
"package": "com.abc.abc",
"versionCode": 2
},
"web": {
"favicon": "./assets/favicon.png"
}
},