question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

App crashes on launch after building an apk

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

2reactions
FriendlyUsercommented, Mar 23, 2021

12

0reactions
FriendlyUsercommented, Sep 21, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crashes - Android Developers
There are many situations that can cause a crash in your app. Some reasons are obvious, like checking for a null value or...
Read more >
React-native (Signed) release apk keeps crashing in device
After creating it my app crashed. Taking a step back, I decided to make a new un-edited app and redo the same steps....
Read more >
App crashes when installed from apk, works from debugger
After a bit of searching I created the apk file with the command. dotnet build -c Release -f net6.0-android. and collected the apk...
Read more >
Fixing React-Native android release build - wesionaryTEAM
Android release build crashes on launch but works fine in development mode. After months of research and development, your app is finally ready...
Read more >
React Native Android release build crash on device - Medium
If you tried to generate android release APK by following guide provided in official site of facebook react native, and found your app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found