Posted on



In this ADB Tutorial we will explore some of the more common ADB commands out there. Those are useful both for manual testing and in test automation scripts. Those ADB commands will be the same whether you are on Windows, Mac, or Linux.

Learn how to use ADB commands in Java + Appium Automation framework:

Here is the list of the ADB commands that we covered in this video:
Tell ADB which device to execute command on: adb -s *device id*
Install application: adb install *path to file*
Uninstall application: adb uninstall *package id*
Get info about activity in focus: adb shell dumpsys window windows | findstr Focus
Take Log from buffer: adb logcat -d
Clear Log buffer: adb logcat -c
Take Log continuously: adb logcat
Take Screenshot: adb shell screencap /sdcard/Android/screenshot.png
Pull/Copy Files from Android device: adb pull /sdcard/Android/log.txt
Push/Copy Files to Android device: adb push example.txt /sdcard/Android
Open device’s shell: adb shell
Clear application’s data: adb shell pm clear *package id*
Force-Stop application: adb shell am force-stop *package id*
Open application’s activity: adb shell am start -c api.android.intent.LAUNCHER -a api.android.category.MAIN -n *package/activity*
Send Android Keyevent: adb shell input keyevent 3
Send Text: adb shell input text “Artur”
Dumpsys debug utility: adb shell dumpsys | findstr “DUMP OF SERVICE”
Device Properties: adb shell getprop *key*

Nguồn:https://hdwallpaperslovely.com/

48 Replies to “ADB Tutorial: How to use ADB”

  1. When I type adb logcat and hit enter I don't get anything.
    Also when I type adb logcat > anoop.txt and hit enter then the file anoop.txt is made but contains nothing

  2. i have a problem with many Android devices janam xt2 they stuck at the splash screen

    i tried to reboot devices in recovery mode wipe cache data then reboot devices

    still same issue second step factory reset ; still devices stuck at splash screen

    i tried to falsh PDA with manufacture tools

    i used fastboot devices the devices is detected

    the driver is installed as well

    when i start flash program the processe stop and give a errors message

    NB itried with usb cable and cradle

    error: no devices/emulators found
    32a2fd7 fastboot
    "Partition table…"
    "Flash nCPU…"
    Sending 'modem' (48513 KB) OKAY [ 1.685s]
    Writing 'system' FAILED (remote: 'flash writ
    failure')
    fastboot: error: Command failed
    "Flash fail"
    "Please check the USB connector"
    Press a key to continue..

  3. i have a problem with many Android devices janam xt2 they stuck at the splash screen

    i tried to reboot devices in recovery mode wipe cache data then reboot devices

    still same issue second step factory reset ; still devices stuck at splash screen

    i tried to falsh PDA with manufacture tools

    i used fastboot devices the devices is detected

    the driver is installed as well

    when i start flash program the processe stop and give a errors message

    NB itried with usb cable and cradle

    error: no devices/emulators found
    32a2fd7 fastboot
    "Partition table…"
    "Flash nCPU…"
    Sending 'modem' (48513 KB) OKAY [ 1.685s]
    Writing 'system' FAILED (remote: 'flash writ
    failure')
    fastboot: error: Command failed
    "Flash fail"
    "Please check the USB connector"
    Press a key to continue..

  4. Nice video…

    Hi. I have an issue… Need help !!!

    Have a oneplus one, 64gb, LineageOS 15.1, twrp 3.3.1.0

    Need to make full backup, but no enough free memory. Try to twrp direct to pc(win 10)

    Did adb device, and I see my phone..OK

    But when I try:
    adb backup –twrp

    Did not work. Shows back a error:

    adb unable to connect for backup: device '(null)' not found

    I DO NIT KNOW WHAT TO DO NEXT… 🙁

    need help !!!

  5. I like your video very much. It's really great. I'll keep an eye on your channel. I am your fan and I will support you.

  6. I will like to ask how do we use `$ adb sync` ? i saw this command but I am not exactly sure about the usage description:

    sync [system|vendor|oem|data|all]
    sync a local build from $ANDROID_PRODUCT_OUT to the device (default all)
    -l: list but don't copy

  7. You are a good speaker. But the main problem is we can't able to read what you type. So , make sure in the next video , we can able to read as well .it is hard for the beginners like me , to completely understand the things in the first go itself.

  8. I now have (or I had a phone) a Xiaomi Redmi 4x phone that fell into the water and no longer works at all.

    My computer sees him as QDLoader 9008, but I can not bring him to mod Fastboot, or Edl.

    The phone is dead! The screen does not turn on, it does not vibrate … nothing!

    Does anyone know a way to write the ROM on it without working in any way?

    I tried writing the ROM with "Qualcomm_Flash_Image_Loader" or ADB, but it does not work! It must be brought in Fastboot, but I can not !!! Can you help me somehow?
    ( https://forum.xda-developers.com/showpost.php?p=78606812&postcount=617 )

  9. Could you possibly film more videos on adb and advanced tips and tricks with Android in general? I would really love to see it. Thank you for this video and happy New Year.

  10. hello , i have a question pls , can we remove the password with abd in recovry mode ? to access to the phone or just the files

  11. Thanks a lot for this nice tutorial video on ADB commands. Is there any command for 'Long press'. If it will helpful.

  12. Very interesting your video. I would like if is it possible to run a file .bat from my computer through the adb (cmd) to my android emulator. Please answer me and explain me how to do it? Thanks and keep doing interesting videos 🙂

  13. This is one nifty command, first time seeing it 🙂
    adb shell dumpsys window windows | findstr Focus
    Now I can programatically blow up my phone he-he
    Question: If I already know the package name such as "org.vndnguyen.shortcutmaster" (ShortcutMaster) what's an easy way to list all its activities and determine the main one of that package? Anything with the "pm" command? Thanks in advance.

  14. good tutorial but what if you have two devices ? how to target only one ?
    in my case i share internet connection via usb from pc to android and it require ADB "program named gnirehtet", but when i open android emulator on pc "LDplayer" automatically Adb disconnect from android , and i don't know how to target one only

  15. What a great introduction to adb! I can't understand why I haven't seen this video before as I navigated over countless threads with all kinds of cobbled up recipes to get full control of your device, when it's all available right from the adb command line!

    Then again, with the amount of scaremongering evident in some of the comments here, I'm not surprised device providers, manufacturers and even enthusiast sites have deemed users just too stupid and have put so much effort to prevent people from gaining true access to their devices.

    Thank you for cutting to the chase and showing us that adb IS android 101. Kudos, subscribed!

  16. how do i install a launcher and set it as default (after lockscreen, i get black screen but with top line icons eg. clock , signal, battery. also, i can swipe down from top normally)

  17. you did not tell how to capture and save logs after you clear all logs in order to reproduce the issue and save the particular bug for developers

  18. Hi Artur,
    I need help with sm-j700f/ds.i tried to flash rom and use adb to push rom but all failed!
    This phone has no OS installed and no backups. I saw the secure download
    enabled in download mode(i think this is the problem). I also tried kies
    and smart switch but they can't recognize this model. Pls help me thanks.

  19. Hi! I tried several times didn't work. I deleted home wiz launcher by mistake…wanting the nova launcher. Now my screen is black can you fix this I will pay you pleeeeeezzzzzzzze?

  20. Hey, maybe you know the answer to the problem I am having with my Chinese made tablet. When I turn on my wifi for the tablet, software starts downloading and installing on there own. I can't stop it. I connected the tablet to my PC and I see in the Download Provider/preload follder a file named myslave.apk. What is that? I did a search and on a Chinese website I found that it is a card game….? Is that actually what it is? I don't know. Or, is it the root of why mostly games are downloading on their own. Any help is appreciated.

  21. Hello Friend. I am from Venezuela, could you help me, I have a blue phone
    Studio 5.0 CE and I do not know how to extract the commands to place them with the ADB, I want to revive the phone and only allows me to place the commands with ADB I want to extract the commands from the rom And I do not know what they are or how to extract them, I already have the official rom Download and I have the ADB program installed on my computer I only need that one Information, thanks

  22. hi artur, pls. help me to install my android.hardware.usb.host.xml
    pls. give me a step by step if possible. my unit is grand prime g530h lollipop 5.0.2
    thanks in advance

  23. bro i don't understand iam new to this do you have whatsapp so you can guide me through step by step…

Leave a Reply

Your email address will not be published. Required fields are marked *