Fahime Zivdar
Posted on May 20, 2021
==> 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
adb -p install Myapp.apk //-p
------------------------------------------------------------------
==> Uninstall app
adb uninstall com.package.myapp
adb uninstall -k com.facebook.katana //-k Keep the data and cache directories around after package removal.
------------------------------------------------------------------
==> 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 Fastboot or Bootloader mode.
adb reboot recovery //Reboots the device into recovery mode.
-----------------------------------------------------------------------
==> 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 // list info on one package
adb shell path // 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
-----------------------------------------------------------------------
==> Connection Managment
adb tcpip 5555 // Set the target device to listen for a TCP/IP connection on port 5555
adb connect 192.168.1.20:5555 // Connect to the device by its IP address
adb disconnect // Disconnect the USB cable from the target device.
adb devices // You can generate a list of attached devices
Posted on May 20, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
September 1, 2024