Godot Version
4.3 mono
Question
It appears that using one-click deploy to Android deletes all files in the user:// directory. If you run the game from the device a subsequent time, the files remain, until you deploy again. It makes it exceedingly difficult to develop if you can’t effectively save data to the device (no, I don’t want to request permission to write elsewhere on the device)
Is this expected behaviour, an Android bug, or a Godot bug?
Is there a permission problem or another export setting that needs changing?
Godot doesn’t have any problem reading and writing to the user:// directory.
I’ve tried setting android:hasFragileUserData=“true” by setting “Retain Data on Uninstall” to on. I get the prompt asking if I want to keep data when uninstalling on the device. It still deletes the user:// data anyway whether uninstalling from the device or uninstalling as part of the one-click deploy process.
Fixed.
Its in the editor settings → export → android → One Click Deploy Clear Previous Install
Easy once you know how.
Its in the editor settings → export → android → One Click Deploy Clear Previous Install
Easy once you know how.
This didn’t affect anything for me… I found this in adb logcat
though:
BackupManagerService: Restore manifest signatures do not match installed application for org.example.mypackagename
BackupManagerService: restoreFinished packageName=org.example.mypackagename
BackupManagerService: Unable to finalize restore of org.example.mypackagename
If i change the package ID it fixes the issue (the new package id can be re-installed without losing all the user://
files!)
This means you may be able to clear your cloud backups to fix this issue (without changing your package id)
see android - BackupManagerService: Unable to finalize restore - Stack Overflow
https://developers.meta.com/horizon/documentation/unity/ps-cloud-backup/
You may need to disable cloud backup or use multiple export profiles with different package IDs for this feature to work: (see the same page at #how-do-i-turn-off-cloud-backup-for-my-title-if-i-dont-want-it-to-be-used)