mondayboy
mondayboy

Reputation: 3

fullBackup: User 10193 does not have android.permission.BACKUP

When I run backup command(bu) from my android app, the following error messages ware displayed. I don't know why this error message shown. Would you tell me how to avoid the error?

=== my app code ===
String cmd = "/system/bin/bu " + 2 + " backup -apk -noshared -all -nosystem";
Process process = Runtime.getRuntime().exec(cmd);
===

=== error message ===
D/AndroidRuntime(23189): Calling main entry com.android.commands.bu.Backup
D/bu      (23189): Beginning: 2
E/bu      (23189): Error running backup/restore
E/bu      (23189): java.lang.SecurityException: fullBackup: User 10193 does not have   android.permission.BACKUP.
E/bu      (23189):  at android.os.Parcel.readException(Parcel.java:1327)
E/bu      (23189):  at android.os.Parcel.readException(Parcel.java:1281)
E/bu      (23189):  at android.app.backup.IBackupManager$Stub$Proxy.fullBackup(IBackupManager.java:628)
E/bu      (23189):  at com.android.commands.bu.Backup.doFullBackup(Backup.java:110)
E/bu      (23189):  at com.android.commands.bu.Backup.run(Backup.java:56)
E/bu      (23189):  at com.android.commands.bu.Backup.main(Backup.java:38)
E/bu      (23189):  at com.android.internal.os.RuntimeInit.finishInit(Native Method)
E/bu      (23189):  at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:262)
E/bu      (23189):  at dalvik.system.NativeStart.main(Native Method)
D/bu      (23189): Finished.
D/AndroidRuntime(23189): Shutting down VM

Upvotes: 0

Views: 743

Answers (1)

Digital Cubes
Digital Cubes

Reputation: 34

I had the same exception error.

The problem is that I was connected to ADB as the application (run-as application).

Just execute "ADB -d shell" (-e if emulated device) and then the backup commands.

Hope it helps someone.

Upvotes: 1

Related Questions