How To Enable USB Debugging Mode On Android Device

If you want to run android app automation test using Appium in physical android device such as phone or pad, you need to first enable USB debugging mode in your physical android device and then connect it with your PC using data line. Below are steps about how to do that.

Step 1: Enable Developer Options.

This is the prerequisites before you can enable USB debugging mode on android device. If you have already do this step before, then you can go to step 2 directly.

  1. Click Settings icon in main screen.
    android settings menu in main screen
  2. Scroll down in Settings menu list, check whether there is a menu named ” Developer options ” at bottom, if you see that option you can click it into detail to disable it or enable it. That means you have do this step before, you can skip step 1 and go to step 2. In my example you can see that option because i had enabled it before.
    android settings developer options menu
  3. If you do not see ” Developer options ” menu, you should go to ” About phone ” menu and tap it.
    android settings about phone menu item
  4. Scroll down to ” Build number ” menu item in ” About phone ” menu list.
    android menu settings about phone build number
  5. You need totally tap seven times on ” Build number ” menu item, after the first three tap, it will popup message show you something like ” If you continue tap twice or more you will be a developer “, keep typing until you see another message like ” You are developer now. ” like below picture.
    set android phone to developer mode
  6. Then go back to Settings menu list, you can see ” Developer options ” menu item in it.
READ :   How To Use Android Debug Bridge (ADB)

Step 2: Enable USB Debugging Mode

After enable ” Developer options ” menu in step 1, you can enable USB debugging mode now. But what I want to remind you of is that do not make your android phone or pad in USB debugging mode always, just enable it when you needed. There are security risk in that mode because it permit high-level operation on your android device. So disable this option immediately after you use it. This can make your phone safety.

  1. Type on ” Developer options ” menu item in Settings menu list.
    android settings developer options menu
  2. Check ” USB debugging ” checkbox to enable it.
    android settings developer options enable usb debugging
  3. It will prompt you to ask whether ” Allow USB debugging ” or not, click OK button.
    android settings developer options enable usb debugging popup message
  4. Now the enable USB debugging mode operation is completed successfully.

Step 3: Check Whether Device Is Connected With PC Properly

Use a USB line to connect your android device with PC, then you can run below dos command to verify that android devices in USB debugging mode is connected with PC properly.

  1. Open dos window.
  2. Execute command ” adb devices “. Then you can see connected android devices list as below.
    android usb debugging mode connected devices with pc list
  3. If you can not see any device, maybe it is because of connection issue or you do not enable USB debugging mode correctly. The most possible reason is that you do not install your android device USB driver correctly in your PC. Click here to download Samsung device USB driver,
    Click here to download Lenovo device USB driver , Click here to download HTC device USB driver. Otherwise you can go to your phone’s manufacturer website to download related USB driver.
READ :   Appium Introduction : Concepts, Design, Architecture

Install Google USB Driver In Android SDK Manager

If you really can not find correct USB driver for your android device, you can install google’s default USB driver, it can be used to install some android devices.

  1. Launch Android Studio, click ” Tools —> Android —> SDK Manager ” menu item.
    android studio menu item tools android sdk manager
  2. In the popup dialog, check ” Google USB Driver ” checkbox, click Apply button. Then click Finish button in next dialog to complete the install.
    install google usb driver in android sdk manager
  3. Click windows Start menu, input “Device Manager” in windows command input box. Click Enter.
    run device manager win10
  4. In the device manager widow, right click your portable devices.
    windows device manager portable devices list
  5. Click Properties menu in above popup menu list. It will open detail properties dialog. Click ” Update Driver ” button.
    windows device manager portable devices detail properties
  6. Browse to the google USB driver saved directory. Commonly you can find the driver in your android sdk installation directory like C:\Users\Jerry\AppData\Local\Android\sdk\extras\google\usb_driver.
  7. After install google provided USB driver, you can see that device use adb devices command.

Now you can run native android app automation test in your physical android device using Appium and selenium webdriver, we will introduce that in later articles.

(Visited 559 times, 1 visits today)

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.