question

PaulWeston-4678 avatar image
0 Votes"
PaulWeston-4678 asked PaulWeston-4678 edited

Android asset will not transfer to local storage on upgrade

Hi all

When my app runs for the first time, it copies a number of .json files from the android Assets/files folder to the user's internal storage:
/data/user/0/com.My.App/files/json/filename.json.

This has always worked without issue.

I recently released an update, which required an additional file to be copied from/to the same folders. Everything works fine for a new install, but with an upgrade it results in:

System.IO.FileNotFoundException: Could not find file "/data/user/0/com.My.App/files/json/filename.json"

This is for the new file only. All other files are found.

I realised when testing on a Huawei device that disabling the feature Settings > System & updates > Backup & restore > Auto-restore – Restore backed up settings and data to apps when they are reinstalled, caused the file to be transferred successfully. But this loses all the user's previous settings.

Has anyone experienced this same issue? Is there a way of forcing the new file to be saved to local storage on upgrade? Some configuration setting I'm missing perhaps.

Thanks in advance

Paul

dotnet-xamarinformsdotnet-androiddotnet-xamarinessentials
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

You could ask this question on Huawei developer forum.


0 Votes 0 ·

TThanks for your reply.

However, my description is perhaps misleading. It happens on all the devices I've tried, including Pixel. It's just that I happened to discover the cause on a Huawei device.

0 Votes 0 ·

0 Answers