MuntashirAkon/AppManager · error · BackupException
Android System (android) cannot be backed up.
Error message
Android System (android) cannot be backed up.
What it means
BackupManager.backup explicitly refuses to back up the Android System package ("android"), because backing up the system itself is unsupported and would be meaningless/harmful. It throws BackupException before any backup work starts.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupManager.java:65
} else if (TarUtils.TAR_ZSTD.equals(tarType)) {
return ".tar.zst";
} else return ".tar.gz";
}
private boolean mRequiresRestart;
public BackupManager() {
ExUtils.exceptionAsIgnored(BackupItems::createNoMediaIfNotExists);
}
public boolean requiresRestart() {
return mRequiresRestart;
}
public void backup(@NonNull BackupOpOptions options, @Nullable ProgressHandler progressHandler)
throws BackupException {
if (options.packageName.equals("android")) {
throw new BackupException("Android System (android) cannot be backed up.");
}
if (options.flags.isEmpty()) {
throw new BackupException("Backup is requested without any flags.");
}
BackupItems.BackupItem backupItem;
try {
if (options.override) {
backupItem = BackupItems.findOrCreateBackupItem(options.userId, options.backupName, options.packageName);
} else {
backupItem = BackupItems.createBackupItemGracefully(options.userId, options.backupName, options.packageName);
}
} catch (IOException e) {
throw new BackupException("Could not create BackupItem.", e);
}
if (progressHandler != null) {
int max = calculateMaxProgress(options.flags);
progressHandler.setProgressTextInterface(ProgressHandler.PROGRESS_PERCENT);
progressHandler.postUpdate(max, 0f);View on GitHub (pinned to 0152f468fc)
Solutions
- Filter out packageName "android" before invoking backup
- Skip system-only package in your package iteration loop
- Catch BackupException and skip/log instead of failing the whole batch
- Only back up user-installed packages
Example fix
// before
for (String pkg : packages) backupManager.backup(makeOptions(pkg), null);
// after
for (String pkg : packages) {
if ("android".equals(pkg)) continue; // system package not backup-able
backupManager.backup(makeOptions(pkg), null);
} Defensive patterns
Strategy: validation
Validate before calling
if ("android".equals(options.packageName)) {
throw new IllegalArgumentException("Android System package cannot be backed up");
} Prevention
- Filter the "android" package out of batch backup lists
- Skip packages with no application info
- Validate package names before constructing BackupOpOptions
When it happens
Trigger: Calling BackupManager.backup(options, progressHandler) with options.packageName set to "android".
Common situations: Enumerating all installed packages (including the "android" system package from pm list packages) and passing each to backup without filtering, batch-backup scripts.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Backup is requested without any flags.
- Android System (android) cannot be restored.
- Restore is requested without any flags.
- Package name mismatch: Expected=${mPackageName}, Actual=${mP
- Could not read package name.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/71b4f80b31c2a208.
Report an issue: GitHub.