How to test android apps in a real device with Android Studio?

前端 未结 10 1862
执念已碎
执念已碎 2020-12-01 10:25

I started to develop in android with Android Studio IDE, I tested my apps on the emulator and works fine, but when I tried to test the apps directl

相关标签:
10条回答
  • 2020-12-01 10:57

    To test an android apps in a real device with Android Studio, You must keep two things in mind

    1. You should enable USB debugging option on your android phone.
    2. You must have driver installed on your computer.

    Now , let me tell you how you can enable USB debugging on your android phone:

    1. Go to Settings on your android phone
    2. Scroll down to the bottom and click on About phone
    3. On this menu also scroll down to the bottom, you should see something Build number
    4. Click on Build number 7 times
    5. Now your Developer Option enables, once you done click on back button and you should see a new option on your android screen i.e. Developer Options
    6. Click On Developer Options
    7. Scroll down until you see USB Debugging
    8. Go ahead and click the check box next to the USB debugging
    9. Now your USB Debugging option enables.
    10. Connect your android device to your computer with the help of USB connector.

    Now let me tell you how you can download the driver on your Windows PC:

    1. Your windows machine need a software called driver to communicate with your phone.
    2. Go To OEM USB Driver Website to install your appropriate driver
    3. Scroll down and select the driver appropriate for your device. Check the screen shoot
    4. Once you download it , you have to unzip your file
    5. After Installing Google USB Driver, close SDK Manager window, Connect your phone or tablet through USB cable to your laptop or PC.
    6. Now click on My Computer (Windows 7) (or) This PC(Windows 8.1).Select Manage.
    7. Select Device Manager –> Portable Devices –> Your Device Name
    8. Right Click on Your Device Name and Select Browse My Computer For Driver Software.
    9. Point it to C:\Users\YourUserName\AppData\Local\Android\sdk\extras\google\usb_driver. Hit Next and Finish.
    10. Now Hit Run Button after selecting Your Project in Project Explorer in Android studio. Choose your device and press OK.
    0 讨论(0)
  • 2020-12-01 10:57

    For Android 7, Galaxy S6 Edge:

    1. Settings > Developer Options > Turn the switch ON > Debugging Mode (Turn On)

    If Developer Options is not available then

    1. Settings > About Device > Software Info > Build number (Tap It 7 time)

    Now perform step 1. Now it should work, if its still not working then perform these steps. It worked for me.

    0 讨论(0)
  • 2020-12-01 11:02

    If USB Debugging Mode is enabled and does not work, you should install your device driver.

    For Nexus Devices;

    • Install Google USB Drivers on SDK Tools.
    • Go to Control Panel > Device Manager and check drivers status. (Probably you can see warning icon on ADB Interface Driver.) Select ADB Interface driver and click update. Choose "Browse my computer for driver software" and set folder path like "D:\Users\userName\AppData\Local\Android\sdk".

    For Another Devices;

    • If you install the model's driver, it may work. For ex: Samsung Kies, LG PC Suite.

    Hope it helps!

    0 讨论(0)
  • 2020-12-01 11:03
    • First we have to enable the USB debugging mode. for that go to Settings -> Developer Options ->USB debugging in your phone checked it and allow it.
    • After it open android studio, click on SDK manager , check mark the Google USB Driver and hit install package.
    • After Installing Google USB Driver, close SDK Manager window, Connect your phone or tablet through USB cable to your laptop or PC.
    • Now click on My Computer (Windows 7) (or) This PC(Windows 8.1).Select Manage.
    • Select Device Manager –> Portable Devices –> Your Device Name
    • Right Click on Your Device Name and Select Browse My Computer For Driver Software.
    • Point it to C:\Users\YourUserName\AppData\Local\Android\sdk\extras\google\usb_driver. Hit Next and Finish.
    • Now Hit Run Button after selecting Your Project in Project Explorer in Android studio. Choose your device and press OK.
    0 讨论(0)
  • 2020-12-01 11:11

    I can run on my device at last, just I enabled the "USB debugging" and "Allow mock location" options from the Debug Menu of my device.

    0 讨论(0)
  • 2020-12-01 11:13

    I tried @Mr. Stark answer. It didn't work. It failed to install the drive. I have Samsung S8 plus. I enabled the debugging mode on device then installed Android USB Driver for Windows from Samsung site, it works.

    0 讨论(0)
提交回复
热议问题