Skip to content

Instantly share code, notes, and snippets.

@hatamiarash7
Forked from Fahime-zv/List of ADB for Android
Last active November 3, 2021 02:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hatamiarash7/409f3f46828d086afa617469172503e0 to your computer and use it in GitHub Desktop.
Save hatamiarash7/409f3f46828d086afa617469172503e0 to your computer and use it in GitHub Desktop.
==> Install app
adb install Myapp.apk
adb -d install Myapp.apk // -d : directs command to the connected USB device
adb -e install Myapp.apk // -e : directs command to the running emulator
adb -s install Myapp.apk // -s : serial number
adb -p install Myapp.apk // -p : product name or path
----------------------------------------------------------------------------------------------------------
==> Uninstall app
adb uninstall com.package.myapp
adb uninstall -k com.facebook.katana // -k : Keep the data and cache directories around after package removal
----------------------------------------------------------------------------------------------------------
==> Update app
adb install -r Myapp.apk // -r : Re-install app and keep its data on the device
----------------------------------------------------------------------------------------------------------
==> Logcat
adb logcat // displays the log data onto the screen
adb logcat -c // you can clear the existing logs on an Android device
adb logcat -d > [path_to_file] // you can save the logcat output to a file on your computer
----------------------------------------------------------------------------------------------------------
==> Reboot device
adb reboot // ADB can be used to reboot your device, useful when your hardware buttons aren’t working
adb reboot bootloader // Reboots the device into the Bootloader mode
adb reboot fastboot // Reboots the device into the Fastboot mode
adb reboot recovery // Reboots the device into recovery mode
adb root // Reboots the device with root permissions
----------------------------------------------------------------------------------------------------------
==> Bugreport
adb bugreport // Displays the Android device information such as dumpsys, dumpstate and logcat data on the screen.
adb jdwp // Lists the JDWP (Java Debug Wire Protocol) processes on the device. if you’re not already aware of it, chances are you don’t have to worry about it either.
----------------------------------------------------------------------------------------------------------
==> Server
adb start-server // Starts the adb server process
adb kill-server // Stops the adb server process (terminal adb.exe process)
----------------------------------------------------------------------------------------------------------
==> Files
adb pull /sdcard/screenrecord.mp4 // This command can be used to pull any files from your device and save it on your computer. To download or pull a file from your Android device to the SDK platform-tools directory, use
adb pull /sdcard/screenrecord.mp4 e:\ // If you want to download a file from your phone’s storage to a specific drive on your computer, execute the this command
adb push Myapp.apk /sdcard // This command can be used to push a file from your computer to your device. If the file to be pushed it save in the SDK folder, use
adb push e:\Myapp.apk /sdcard // To push or send a file to your Android from a specific drive on your computer, use
----------------------------------------------------------------------------------------------------------
==> Permissions
adb shell pm reset-permissions -p com.package.myapp // Reset App's permission
adb shell pm grant [packageName] [Permission] // Grant a permission to an app
adb shell pm revoke [packageName] [Permission] // Revoke a permission from an app
----------------------------------------------------------------------------------------------------------
==> Package info
adb shell list packages // list package names
adb shell list packages -r // list package name + path to apks
adb shell list packages -3 // list third party package names
adb shell list packages -s // list only system packages
adb shell list packages -u // list package names + uninstalled
adb shell dumpsys package packages // list info on all apps
adb shell dump <name> // list info on one package
adb shell path <package> // path to the apk file
----------------------------------------------------------------------------------------------------------
==> Print text
adb shell input text 'Hello world'
----------------------------------------------------------------------------------------------------------
==> Screenshot
adb shell screencap -p /sdcard/screenshot.png
----------------------------------------------------------------------------------------------------------
==> Monkey
adb shell monkey -p com.myAppPackage -v 10000 -s 100 // Monkey is generating 10.000 random events on the device
----------------------------------------------------------------------------------------------------------
==> Other
adb backup // Create a full backup of phone and save to the computer
adb restore // Restore a backup to phone
adb sideload // Push and flash custom ROMs
----------------------------------------------------------------------------------------------------------
@Fahime-zv
Copy link

That's so great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment