App crashes on launch after building an apk
During development the package worked perfectly well but after building it using expo build, it crashes on launch. How do I resolve this?
Package used: react-native-version-checker-expo
Package version: ^3.4.2
Method of Usage:
I import the package using import VersionCheck from 'react-native-version-check-expo'. Then, placed the lines below in my App.js file
useEffect(() => {
VersionCheck.needUpdate().then(async (res) => {
if (res && res.isNeeded) {
return Alert.alert(
"New App Update!",
`There is a new version. Kindly update now to enjoy the best experience.\n\nSelect 'OK' to open the Play Store.`,
[
{ text: "Cancel", style: "cancel" },
{ text: "OK", onPress: () => Linking.openURL(res.storeUrl) }, // open store
],
{ cancelable: false }
);
}
});
}, []);
I get this error when I hover on the imported package:
Could not find a declaration file for module 'react-native-version-check-expo'. 'c:/dev/ecomobile/node_modules/react-native-version-check-expo/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/react-native-version-check-expo if it exists or add a new declaration (.d.ts) file containing declare module 'react-native-version-check-expo';
I am having a similar issue.
I had a similar issue of the app crashing which I fixed by downgrading node
That's interesting. Which version of node worked for you?
12
any solution ?
alternatively for react-native-version-check you can try to use
useEffect(() => {
setTimeout(()=> {
VersionCheck.needUpdate().then(async (res) => {
if (res && res.isNeeded) {
return Alert.alert(
"New App Update!",
`There is a new version. Kindly update now to enjoy the best experience.\n\nSelect 'OK' to open the Play Store.`,
[
{ text: "Cancel", style: "cancel" },
{ text: "OK", onPress: () => Linking.openURL(res.storeUrl) }, // open store
],
{ cancelable: false }
);
}
});
}, 3000)
}, []);
To make sure the check if not fired directly when the app mounts, that seems to have fixed the issue on ios for us.