问题
I've been using Cordova cli for a couple years now. Today I updated from Cordova 5.4.0 to 6.0.0
npm install -g cordova@latest
then I updated android platform to 5.1.0 from the previous version
cordova platform update android
ran it
cordova run android
Noticed the icon on my device was replaced and added to the end of all apps. More importantly the localstorage data is missing. Not just once but each time I run it. Long ago I ran into this issue when I rebuilt from scratch with a different package name. This was just the commands above. The package name didn't change. For that matter nothing changed in config.xml nor AndroidManifest.xml
Any clues where to start. It clears storage each time I run
cordova run android
It holds the data when stopping and restarting on the device. For reference these lines never changed in config
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="AndroidExtraFilesystems" value="files" />
The package name in config.xml ends in -dev as always which I take off before building a release.
Update 2016-02-22 This may be related https://issues.apache.org/jira/browse/CB-10157 If I'm reading that right it will be fixed on android 5.2.0, I could not find any info on when that may occur.
回答1:
Thanks for linking your issue with mine.
In my case it was indeed related to CD-10157. It did however get fixed with Version 5.1.1 already, which was released March 2nd.
https://cordova.apache.org/announcements/2016/03/02/cordova-android-5.1.1.html
I just upgraded to the latest version this morning, and it seems to be working fine now.
来源:https://stackoverflow.com/questions/35283679/constantly-losing-storage-after-cordova-6-0-0-update