问题
I need to deploy a new version of my Android app made with Xamarin. My app stores files in the following path:
android > data > APP.PACKAGE_NAME > files > data
The problem is those files are wiped after the upgrade and the app needs to resync with the remote server, is this behavior normal or am I missing something ?
What I do is upgrade the version number in the properties > Android Manifest, then Archive and deploy the generated apk on my device.
回答1:
If your device is rooted, it can be the cause of your problem.
Database (Sqlite-net) do not persist between build on Monodroid
The device was somewhat rooted (or not). I have read somewhere that this might be an issue so I followed these steps:
1. Installed KingoRoot
2. Device "was already rooted" (broken), but rooted it with KingoRoot, then crashed
3. Tried to root it again with success
4. UnRooted the device with SuperUser
5. Uninstalled KingoRoot
6. Now data is preserved when compiling/debugging to the device.
来源:https://stackoverflow.com/questions/44154134/xamarin-how-to-upgrade-android-app-and-keep-files-under-android-data-folder