ADB

Android Debugging Bridge - Basics

Enable developer mode (Samsung)

  • Go to 'Settings'
  • Go to 'Device Info'
    • Press the 'Buildnumber' 7 times
  • Developer mode is now activated

    Enable USB debugging (ADB)

    • Go to 'Settings'
    • Go to 'Developer Options'
      • Press to check to enable the 'USB debugging' feature

    Minimal ADB and Fastboot (Windows)

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

    Device Factory Reset

    • Samsung: Press and hold Home + Volume Up + Power

    Search and logging

    Search for packages (commands)

    adb shell
    pm list packages
    • Shows all available packages

    pm list packages | grep <app.name>

    • Shows only the package(s) named <app.name>*

    Logcat

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

    adb logcat -v long > logfile.txt 

    Backup

    Command parameters

      • adb backup [-f <file>] [-apk|-noapk] [-shared|-noshared] [-all] [-system|nosystem] [<packages...>]
    • Example

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

    Summary

    • -f <file>

    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.

    • -apk | -noapk

    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.

    • -shared | -noshared

    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.

    • -all

    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.

    • -system | -nosystem

    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.

    • <packages_>

    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

    • /data
    • /cache
    • /system

    External storage directories

    • /storage/sdcard0
    • /storage/sdcard0/Alarms
    • /storage/sdcard0/DCIM
    • /storage/sdcard0/Download
    • /storage/sdcard0/Movies
    • /storage/sdcard0/Music
    • /storage/sdcard0/Notifications
    • /storage/sdcard0/Pictures
    • /storage/sdcard0/Podcasts
    • /storage/sdcard0/Ringtones

    Application directories

    • /data/data/package/cache
    • /data/data/package/files
    • /data/data/package

    Application external storage directories

    • /storage/sdcard0/Android/data/package/cache
    • /storage/sdcard0/Android/data/package/files/Alarms
    • /storage/sdcard0/Android/data/package/files/DCIM
    • /storage/sdcard0/Android/data/package/files/Download
    • /storage/sdcard0/Android/data/package/files/Movies
    • /storage/sdcard0/Android/data/package/files/Music
    • /storage/sdcard0/Android/data/package/files/Notifications
    • /storage/sdcard0/Android/data/package/files/Pictures
    • /storage/sdcard0/Android/data/package/files/Podcasts
    • /storage/sdcard0/Android/data/package/files/Ringtones

    Analytical device data

    ADB Dumpsys

    Useful commands

    Clear launcher

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