How to Restore Debloated Apps Using Universal Android Debloater Next Generation
Universal Android Debloater Next Generation (UAD-NG) restores debloated apps by reading a JSON backup file and reverting package states through ADB commands, available via both CLI and GUI interfaces.
Universal Android Debloater Next Generation (UAD-NG) provides a reliable restore workflow to recover apps previously disabled or uninstalled during debloating sessions. The tool generates JSON backup snapshots that record package states, allowing you to revert changes safely. Understanding how to restore debloated apps using Universal Android Debloater Next Generation ensures you can recover critical functionality if you accidentally remove essential system components.
The Core Restore Architecture
Backup-Driven Recovery
UAD-NG implements restore functionality through three integrated components defined in the core library. The backup logic resides in crates/uad-core/src/save.rs, containing the backup_phone and restore_backup functions that handle JSON serialization. The CLI interface exposes these capabilities through the restore sub-command defined in crates/uad-cli/src/main.rs. The GUI integration provides a user-friendly Restore button in the Settings view, handled by handle_restore_device in crates/uad-gui/src/views/settings.rs.
How the Restore Routine Works
The restoration process follows a precise sequence to ensure safe recovery. First, it loads the selected backup file from settings.backup.selected.path and parses the JSON into a PhoneBackup struct (lines 111-126 in save.rs). For each user recorded in the backup, the system locates the matching user on the connected device, then iterates through every stored package to verify its existence in the current package list.
If a package exists, the routine computes the necessary ADB commands to revert its state—enabling previously disabled apps or reinstalling uninstalled ones—via apply_pkg_state_commands. The function returns a RestoreResult containing command batches (BackupPackage) that the UI or CLI executes sequentially. Missing packages trigger a warning and increment the skipped_count (lines 144-149), while successful restores report the number of reverted applications.
Prerequisites for Restoration
Before initiating a restore operation, verify three conditions. The device must maintain an active ADB connection recognized by UAD-NG. You must possess a previously generated backup file created through the GUI Backup button or uad backup CLI command. The restore operation only affects packages that were disabled or uninstalled at backup time; it cannot reinstall packages that never existed on the device.
How to Restore Using the CLI
The command-line interface provides precise control over restoration operations through the restore sub-command.
List available backups to identify your target file:
uad list-backups
Set the backup file environment variable and restore a specific package:
export UAD_BACKUP=~/uad_backups/2024-08-12_14-30-00.json
uad restore com.google.android.gms
Restore all packages from the selected backup:
uad restore --all
The CLI parses the UAD_BACKUP environment variable to populate settings.backup.selected (see main.rs line 85), then invokes restore_backup from the core module to generate the restoration commands.
How to Restore Using the GUI
The graphical interface simplifies restoration through the Settings panel. Navigate to Settings and locate the Backup / Restore section. Click Backup first if you haven't created a snapshot, which generates a JSON file in the folder defined by Config::load_configuration_file().general.backup_folder.
Click Restore to open a file dialog for selecting your backup JSON. After confirmation, UAD-NG displays a progress bar while executing the ADB commands. The handle_restore_device function (lines 225-236 in settings.rs) bridges the UI button to the core restore_backup routine, ensuring consistent behavior with the CLI.
Programmatic Restoration
Developers integrating UAD-NG functionality can invoke the restore routine directly through the core library.
use uad_core::{save::restore_backup, config::Config, sync::Phone, utils::DisplayablePath};
use std::path::Path;
fn restore_from_file(phone: &Phone, backup_path: &Path) -> Result<(), String> {
// Populate settings with the selected backup
let mut cfg = Config::load_configuration_file();
cfg.backup.selected = Some(DisplayablePath {
path: backup_path.to_path_buf()
});
// Call the core restore routine
let result = restore_backup(phone, &phone.package_lists, &cfg.backup)?;
// Iterate over the generated ADB commands
for pkg in result.packages {
for cmd in pkg.commands {
println!("ADB: {}", cmd);
}
}
Ok(())
}
This pattern mirrors the GUI implementation, constructing a DeviceSettings struct pointing to the chosen backup file before calling restore_backup to generate the command sequence.
Edge Cases and Safeguards
UAD-NG implements several protections against restoration failures. Missing packages are silently skipped with a logged warning, preventing crashes when OEMs remove apps entirely. Multiple user profiles resolve correctly through user index matching before command execution. No-op detection identifies when the device state already matches the backup, displaying "Device state is already restored" (line 264) rather than executing redundant commands.
Summary
- UAD-NG restores apps exclusively through JSON backup files created via the backup workflow.
- The
restore_backupfunction incrates/uad-core/src/save.rshandles the core logic, computing ADB commands to revert package states. - Both CLI (
uad restore) and GUI (Settings > Restore) interfaces share identical core functionality. - Restoration requires an active ADB connection and a previously generated backup file.
- Missing packages are skipped gracefully, while existing packages revert from disabled to enabled or uninstalled to installed states.
Frequently Asked Questions
Can I restore apps without a backup file?
No. UAD-NG requires a JSON backup generated through its own backup system to perform restores. The tool cannot recover packages that were debloated before the backup was created or through other tools, as it relies on the PhoneBackup struct data recorded in crates/uad-core/src/save.rs to determine previous states.
What happens if I try to restore an app that no longer exists on my device?
The restore routine skips missing packages and increments a skipped_count counter while logging a warning (lines 144-149 in save.rs). This occurs when manufacturers completely remove package files from the system partition rather than merely disabling them.
Does restoring affect user data or app settings?
Restoration only modifies package states (enabled/disabled or installed/uninstalled) through ADB commands generated by apply_pkg_state_commands. It does not interact with user data directories or app-specific settings, preserving your personal data while recovering the application functionality.
Can I restore specific packages rather than everything from the backup?
Yes. The CLI supports restoring individual packages using uad restore <package_name>, while the GUI allows selective restoration through its package list interface. Both methods filter the backup contents before generating ADB commands, though the underlying restore_backup function processes the entire backup file to determine available actions.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →