ADB

Android Debugging Bridge - Basics

Enable developer mode (Samsung)

Enable USB debugging (ADB)

Minimal ADB and Fastboot (Windows)

cd C:\Program Files (x86)\Minimal ADB and Fastboot

Device Factory Reset

Search and logging

Search for packages (commands)

adb shell
pm list packages

pm list packages | grep <app.name>

Logcat

adb logcat > C:\Users\wwiki\Desktop\androidlogging\logcat.txt

adb logcat -v long > logfile.txt 

Backup

Command parameters

adb backup -apk -shared -all -system -f C:\Users\%username%\Desktop\ADBTOOL\AndroidBackups\xcover3-backup.ab

Summary

Use this to choose where the backup file will be stored, e.g. '-f /backup/mybackup.ab', which will save it at the root of your drive (C:\ for Windows, etc.) in a folder called backup, as a file named 'mybackup.ab'. I recommend using this flag to set a location manually, as with my first backup test, it said that it completed successfully, but I was unable to locate the backup file. I have no idea where it was saved, but it wasn't where it should have been located.

This flags whether or not the APKs should be included in the backup or just the apps' respective data. I personally use -apk just in case the app isn't available in the Market, so that I don't have to go hunt it down again. The default is -noapk.

This flag is used to "enable/disable backup of the device's shared storage / SD card contents; the default is noshared.", which for the Nexus I would certainly flag to -shared, but from my test, it did not restore all of the contents of my internal storage, so I recommend backing up music, pictures, video, and other internal storage items manually, just to be on the safe side. The default is -noshared.

This flag is just an easy way to say to backup ALL apps. The packages flag (further on) can be used to choose individual packages, but unless you're just wanting to backup a specific application, use -all for a full system backup.

This flag sets whether or not the -all flag also includes system applications or not. I used -system, but this is probably unnecessary, and I would almost guess that it is safer to use -nosystem, but use your own judgment on this. The default is -system.

Here you can list the package names (e.g. com.google.android.apps.plus) specifically that you would like to backup. Use this only if you're looking to backup a specific application.

Restore backup through ABD

adb restore C:\Users\wwiki\Desktop\androidbackups\backupfile

Install / uninstall apps

Install app

adb install C:\Users\wwiki\Desktop\eva\AppLockpro_1.49.apk

Uninstall app

adb uninstall com.appslocker.pro

Shell clear data associated with app

adb shell pm clear com.appslocker.pro

Push image or file to device

adb push C:\Users\wwiki\Desktop\eva\MyPhotograph.png /sdcard/Download/

 

Common directory paths

System directories

External storage directories

Application directories

Application external storage directories

Analytical device data

ADB Dumpsys

Useful commands

Clear launcher

adb shell pm clear com.android.launcher
adb shell pm clear com.android.launcher

Revision #3
Created Wed, Oct 10, 2018 12:20 PM by Joel
Updated Fri, Jan 1, 2021 2:16 PM by Joel