-
Notifications
You must be signed in to change notification settings - Fork 467
Android installation is getting corrupted sometimes #43
Comments
Understood. Will fix that. |
I'm getting this on real devices as well, not just in the emulator. It might be related to the fact that the app has a lot of small files and the copy is taking a relatively long time (several seconds). By inspecting the code I'm seeing that files are copied and the 'www' folder is replaced after a new update is installed: https://github.com/nordnet/cordova-hot-code-push/blob/master/src/android/src/com/nordnetab/chcp/main/updater/InstallationWorker.java#L194 I think that ideally the plugin should keep two copies of installations, say www1 and www2 and only swap to www2 if it is fully installed. If it is not, it can keep trying to clear and copy to www2 until everything is verified, and then swap to www2. A second update can then be installed to www1, and by the same logic www1 can then be used as the local folder. Then www2 for the third update and so on. This would at least ensure that users don't get stuck with a really old version when an update fails to install. What would be your thoughts regarding this? |
Actually, from what I can see, a variant of this is implemented and there is a backup folder. However, the backup folder is not rolled back to when I think the following issues need to be fixed.
For point 1, cordova/app start-up may need to be delayed a bit until the backup is restored, if that is even possible. |
More info. I was able to confirm using
That the folder is indeed half-copied. Some files are missing and some are there, the copy didn't go through completely before the app got killed. |
I fixed this and finally got it working correctly. See #44. |
Closing that issue, since main problem was detected and fixed. Will continue to work on making updates more secure, but it will be another issue - #57. |
Sometimes I'm getting an error in the simulator on startup, after chcp tries to install an update. Here's a screenshot:
I assume this may happen because the download or installation didn't fully complete before closing the application on a previous run.
Rerunning the application a second time starts it properly again - but it is reverted to the initially installed version (in the apk), all subsequent chcp installed updates are lost.
It also disables any kind of chcp updates from working until the app is uninstalled and reinstalled. I'm seeing an error reported by chcp on every app start:
"{"action":"chcp_updateLoadFailed","error":{"code":-9,"description":"Failed to load current application config"}}"
The text was updated successfully, but these errors were encountered: