BackupAgent: “unable to restore package …”

被刻印的时光 ゝ 提交于 2019-12-04 04:27:22
marmor

Try adding a dot before your backup class name, as in:

android:backupAgent=".MyBackupAgent"

Or if your backup class isn't in your root package, add the path to it:

android:backupAgent=".package.MyBackupAgent"
Sachithd

Changing android:backupAgent="MyBackupAgent" to android:backupAgent=".MyBackupAgent" worked for me too.

This problem happened when I changed the package name, and then other problems subsequently appeared. It took me a couple hours to figure out.

Disable Instant Run. It messed up things for me.

Check the transports list, make sure Google is set:

adb shell bmgr list transports
    android/com.android.internal.backup.LocalTransport
  * com.google.android.gms/.backup.BackupTransportService

Make sure the BackupAgentHelper package name and the meta-data package name have the same name. The name conflicts could cause a problem.

android:backupAgent The name of the class that implement's the application's backup agent, a subclass of BackupAgent. The attribute value should be a fully qualified class name (such as, "com.example.project.MyBackupAgent"). However, as a shorthand, if the first character of the name is a period (for example, ".MyBackupAgent"), it is appended to the package name specified in the element. There is no default. The name must be specified.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!