Android standalone breaks with Updates API


#1

One of my android users tried to download my app from the google play store and got this error. It runs fine the first time the app launches, but if you quit and re-open, it continues to display that. I have the following code in my App.js:

    componentDidMount(){
        this.loadAssetsAndUpdate()
    }
    loadAssetsAndUpdate = async () => {
        if (!__DEV__ && !this.state.checkedUpdate){
            const update = await Expo.Updates.checkForUpdateAsync()
            if (update.isAvailable){
                try {
                    this.setState({ updating: true, checkedUpdate: true })
                    await Expo.Updates.fetchUpdateAsync()
                    Expo.Updates.reload()
                } catch (error) {
                    Sentry.captureException(new Error(error))
                    this.setState({ updating: false, checkedUpdate: true })
                }
            } else this.setState({ updating: false, checkedUpdate: true })
        }
        await Promise.all(fontAssets)
        this.setState({ loaded: true, checkedUpdate: true, updating: false })
    }

Interestingly enough, the first time I run the android version, it is not the most recent version (it won’t update). However, when re-running the app, it seems to try to update, and fails. What am I doing wrong?

EDIT: It appears it was not the updates api, but a dependency we used that we updated with.


closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.