SFDX-Data-Move-Utility icon indicating copy to clipboard operation
SFDX-Data-Move-Utility copied to clipboard

App crashes on launch after building an apk

Open natemartins opened this issue 3 years ago • 6 comments

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';

natemartins avatar Mar 14 '21 05:03 natemartins

I am having a similar issue.

FriendlyUser avatar Mar 22 '21 23:03 FriendlyUser

I had a similar issue of the app crashing which I fixed by downgrading node

FriendlyUser avatar Mar 23 '21 15:03 FriendlyUser

That's interesting. Which version of node worked for you?

natemartins avatar Mar 23 '21 20:03 natemartins

12

FriendlyUser avatar Mar 23 '21 20:03 FriendlyUser

any solution ?

mohamedanwer123 avatar Sep 20 '22 23:09 mohamedanwer123

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.

FriendlyUser avatar Sep 21 '22 18:09 FriendlyUser