MuntashirAkon/AppManager · error · BackupException
Failed to restore ADB data
Error message
Failed to restore ADB data
What it means
Thrown by restoreAdb when piping the decrypted archive into BackupCompat.adbRestore via a ParcelFileDescriptor fails, for any Throwable. This is the actual hand-off of the archive to Android's adb backup restore mechanism; any failure there (I/O, binder, service failure) is wrapped in this message.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:619
}
private void restoreAdb(int index) throws BackupException {
Path[] dataFiles = mBackupItem.getDataFiles(index);
if (dataFiles.length != 1) {
throw new BackupException("ADB restore is requested but there are no .ab files.");
}
// Decrypt data
try {
dataFiles = mBackupItem.decrypt(dataFiles);
} catch (IOException e) {
throw new BackupException("Failed to decrypt " + Arrays.toString(dataFiles), e);
}
// Restore data
try (InputStream is = dataFiles[0].openInputStream()) {
ParcelFileDescriptor fd = ParcelFileDescriptorUtil.pipeFrom(is);
BackupCompat.adbRestore(mUserId, fd);
} catch (Throwable th) {
throw new BackupException("Failed to restore ADB data", th);
}
}
private synchronized void restoreExtras() throws BackupException {
if (!mIsInstalled) {
throw new BackupException("Misc restore is requested but the app isn't installed.");
}
PseudoRules rules = new PseudoRules(mPackageName, mUserId);
// Backward compatibility for restoring permissions
loadMiscRules(rules);
// Apply rules
List<RuleEntry> entries = rules.getAll();
AppOpsManagerCompat appOpsManager = new AppOpsManagerCompat();
INotificationManager notificationManager = INotificationManager.Stub.asInterface(ProxyBinder.getService(Context.NOTIFICATION_SERVICE));
boolean magiskHideAvailable = MagiskHide.available();
boolean canModifyAppOpMode = SelfPermissions.canModifyAppOpMode();
boolean canChangeNetPolicy = SelfPermissions.checkSelfOrRemotePermission(ManifestCompat.permission.MANAGE_NETWORK_POLICY);
for (RuleEntry entry : entries) {View on GitHub (pinned to 0152f468fc)
Solutions
- Verify the decrypted archive is valid (test with `ab restore` tooling or re-create the backup)
- Try restoring via ADB from a PC (`adb restore file.ab`) to get a clearer system-level error
- Check the Android version: on Android 12+ adb backup is heavily restricted; prefer files-mode backups
- Re-create the backup on the target device with AppManager's native (files) backup mode instead of ADB mode
Example fix
// before
try (InputStream is = dataFiles[0].openInputStream()) {
ParcelFileDescriptor fd = ParcelFileDescriptorUtil.pipeFrom(is);
BackupCompat.adbRestore(mUserId, fd);
} catch (Throwable th) {
throw new BackupException("Failed to restore ADB data", th);
}
// after
try (InputStream is = dataFiles[0].openInputStream()) {
ParcelFileDescriptor fd = ParcelFileDescriptorUtil.pipeFrom(is);
BackupCompat.adbRestore(mUserId, fd);
} catch (Throwable th) {
Log.e(TAG, "adbRestore failed; suggest files-mode backup instead", th);
throw new BackupException("Failed to restore ADB data", th);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
warn("adb backup restore is unreliable on Android 12+; use files-mode backup");
} Try / catch
try {
restoreOp.runRestore();
} catch (BackupException e) {
if ("Failed to restore ADB data".equals(e.getMessage())) {
Log.e(TAG, "ADB restore failed", e.getCause());
fallbackToFilesRestoreOrAbort();
} else throw e;
} Prevention
- Prefer files/tar backup mode over ADB mode on modern Android
- Validate the .ab archive before piping it into the restore
- Ensure the device has free memory and no policy blocking backup operations
- Keep AppManager updated for BackupCompat compatibility fixes
When it happens
Trigger: BackupCompat.adbRestore(mUserId, fd) throws — e.g. pipeFrom fails on the InputStream, the binder transaction fails, the system's restore service rejects the archive, or the decrypted stream is empty/invalid.
Common situations: Android version incompatibility (adb backup deprecated/restricted in newer Android); corrupted decrypted archive; device policy blocking backup restore; insufficient memory opening the stream.
Related errors
- Android System (android) cannot be restored.
- Restore is requested without any flags.
- No base backup found.
- Could not get backup files.
- Failed to backup ADB data.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/5bbf68e613d55adb.
Report an issue: GitHub.