问题
I've created backup rules file just like in example https://developer.android.com/guide/topics/data/autobackup:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content xmlns:android="http://schemas.android.com/apk/res/android">
<include
domain="sharedpref"
path="." />
<exclude
domain="sharedpref"
path="nonceStorage.xml" />
<exclude
domain="sharedpref"
path="localStorage.xml" />
</full-backup-content>
and Android Studio say's that there are errors:
Error:(8, 15) `nonceStorage.xml` is not in an included path [FullBackupContent]
Error:(11, 15) `localStorage.xml` is not in an included path [FullBackupContent]
Error message is totally uninformative and not googleable (almost all words are very short). Can anyone explain,what does this *** want from me? How to fix this issue?
回答1:
I guess this is an IDE bug because the example from doc:
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
</full-backup-content>
shows the same error on device.xml
.
Removing the <include>
clears the error if you simply want to exclude some files because the doc says
By default, Auto Backup includes almost all app files.
回答2:
the error message tells, that there are no such files to exclude in domain sharedpref
:
Error:(8, 15) `nonceStorage.xml` is not in an included path [FullBackupContent]
Error:(11, 15) `localStorage.xml` is not in an included path [FullBackupContent]
possibly it is domain root
- but while not including that domain, no need to exclude them.
<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
<include domain="sharedpref" path="."/>
</full-backup-content>
use the "Device File Explorer" and go to /data/user/0/com.yourapp/shared_prefs
...
there you can see which files belong into which domain - or if they are even present there.
来源:https://stackoverflow.com/questions/51690808/android-full-backup-file-xml-is-not-in-an-included-path