Android完整备份:"file.xml不在包含的路径中"

bab*_*bay 8 android android-backup-service

我创建了备份规则文件,就像示例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>
Run Code Online (Sandbox Code Playgroud)

和Android Studio说有错误:

Error:(8, 15) `nonceStorage.xml` is not in an included path [FullBackupContent]
Error:(11, 15) `localStorage.xml` is not in an included path [FullBackupContent]
Run Code Online (Sandbox Code Playgroud)

错误消息完全没有信息且不可谷歌(几乎所有单词都很短).谁能解释一下,这个***对我有什么要求?如何解决这个问题?

Dew*_*eed 7

我猜这是一个 IDE 错误,因为来自 doc 的示例

<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>
    <include domain="sharedpref" path="."/>
    <exclude domain="sharedpref" path="device.xml"/>
</full-backup-content>
Run Code Online (Sandbox Code Playgroud)

上显示相同的错误device.xml

<include>如果您只是想排除某些文件,因为文档说,删除清除错误

默认情况下,自动备份包括几乎所有的应用程序文件。


Mar*_*ler 0

错误消息表明,域中没有要排除的此类文件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]
Run Code Online (Sandbox Code Playgroud)

可能它是域root- 但虽然不包括该域,但无需排除它们。

<?xml version="1.0" encoding="utf-8"?>
<full-backup-content>

    <include domain="sharedpref" path="."/>

</full-backup-content>
Run Code Online (Sandbox Code Playgroud)

使用“设备文件资源管理器”并转到/data/user/0/com.yourapp/shared_prefs...

在那里您可以看到哪些文件属于哪个域 - 或者它们是否存在于该域中。