How do I reliably include multiple directories from external storage in Android backup rules on API ≤ 30?

11 Views Asked by At

I have backup rules for API ≤ 30 like this:

<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
    <include domain="sharedpref" path="." />
    <exclude domain="sharedpref" path="encrypted_shared_preferences.xml" />
    <include domain="external" path="themes" />
    <include domain="external" path="fonts" />
</full-backup-content>

While similar rules work without issues for API > 30, on emulators with API versions 24 and 27 (at least) only one of these folders is restored.

Judging from the logcat messages, I can see that the files are backed up correctly, but when I look at the restored files, some folders are missing. I ran some more tests, and I see the following. Here, on the left there are source folders, each with a file, and the according rules, and on the right the outcomes.

Source Outcome
ahoy
fonts
fonts2
themes
ahoy
fonts
fonts2
themes
sausage
sausage
fonts
fonts2
themes
sausage
sausage2
sausage2
amazing
fonts
fonts2
themes
fonts
fonts2

I know that there's a limit on how much you can backup, but all of the files here have the size of 0, so it must be something else.

Is there a way around this?

0

There are 0 best solutions below