microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.99k stars 1.47k forks source link

On Android Code Push is Rolled Back on App Restart #2449

Closed malikzype closed 1 year ago

malikzype commented 1 year ago

I have been using CodePush v7.1.0 with RN 0.70.6 in Android App. Currently, we are facing an issue with CodePush getting rolled back automatically on app restart and it asks the user for a new update every time.

On logging the response returned from CodePush, we observed that failedinstall is true every time we restart the app. Can't figure out why exactly this is been happening. We even tried calling CodePush.notifyAppReady() but no luck.

We are using CodePush.checkForUpdate() to check if an update is available and then using custom dialog with sync we download and install the code push.

Can anyone guide me, please? Thank you

npjoge commented 1 year ago

Even I am facing same issue, please help.

dusianandakumar commented 1 year ago

I am getting the same issue on android. Restarting app [CodePush] Update did not finish loading the last time, rolling back to a previous version. [CodePush] Loading JS bundle from "assets://index.android.bundle" getting this error on android code push update install.

I am using these below versions:

"react-native": "0.70.5" "react-native-code-push": "^7.0.5"

AlexeyPimenov commented 1 year ago

Had the same issue "react-native": "0.65.3", "react-native-code-push": "^7.1.0",

Solution for me: Install react-native-restart

And where you call codePush.sync add the following:

import RNRestart from "react-native-restart";

await codePush.sync( { installMode: codePush.InstallMode.IMMEDIATE }, (status) => { switch (status) { case codePush.SyncStatus.UPDATE_INSTALLED: RNRestart.Restart(); break; default: break; } }, ({ receivedBytes, totalBytes }) => { //Something here if needed } );

Screenshot 2023-03-15 at 22 37 55
ali-soltanii commented 1 year ago

Had the same issue "react-native": "0.65.3", "react-native-code-push": "^7.1.0",

Solution for me: Install react-native-restart

And where you call codePush.sync add the following:

import RNRestart from "react-native-restart";

await codePush.sync( { installMode: codePush.InstallMode.IMMEDIATE }, (status) => { switch (status) { case codePush.SyncStatus.UPDATE_INSTALLED: RNRestart.Restart(); break; default: break; } }, ({ receivedBytes, totalBytes }) => { //Something here if needed } );

Screenshot 2023-03-15 at 22 37 55

this solution worked for me

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 1 year ago

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.