Android asset will not transfer to local storage on upgrade

Paul Weston 1 Reputation point

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:

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


A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,315 questions
{count} votes