7

I've been at this for a while. My issue is with using my OnePlus in order to run apps over ADB. As expected, when I connect my OnePlus without USB Debugging enabled, it is connected as a "Portable Device" in my Device Manager. However, when I turn on USB Debugging, the device "disconnects" from the computer altogether (I can't even access the files on it).

I've tried numerous tutorials and driver installers, all unsuccessful. I have the latest Android Studio along with the latest ADB drivers. If anyone could point me in the right direction, that would be much appreciated!

Update: The (ancient) Samsung Galaxy SII works properly when connected to my computer. I can only assume this is an issue with my OnePlus.

mattrick
  • 3,580
  • 6
  • 27
  • 43

11 Answers11

12

I managed to resolve this problem, albeit after many hours, by following these really helpful instructions. I also had to put device into PTP mode, as mentioned by @mattrick in an earlier answer.

If you don't have Android SDK installed, please install it first.

  1. Open Start menu. Select Android SDK Tools -> SDK Manager.
  2. Right-click on it and select "Run as Administrator".
  3. Running SDK Manager as Administrator is very important. If you just click on it, the SDK manager will start, but will encounter errors when you try to install new components!
  4. In the SDK Manager select "Extras->Google USB Driver". Enable the checkbox and click "Install 1 Package".
  5. When the Google USB driver is installed, plug in your device. Warning: The driver won't install automatically. We will do it manually in the next steps.
  6. Open the System Properties dialog (press Win+Break on the keyboard or locate "Computer" in Start Menu, right-click on it and select "Properties".
  7. Click on the "Device Manager" link. In the Device Manager locate your Android device. Then right-click on it and select "Update Driver Software".
  8. Select "Browse my computer for driver software".
  9. Select "Let me pick from a list of device drivers on my computer".
  10. Select "Show All Devices".
  11. Press the "Have Disk" button.
  12. Enter the path to the Google USB driver. Normally it is located in the following directory:

C:\Program Files (x86)\Android\android-sdk\extras\google\usb_driver

  1. Select "Android ADB Interface" from the list of device types.
  2. Confirm the installation of the driver by pressing "Yes".
  3. Confirm the installation again by pressing "Install".
  4. When the installation is done, press "Close".

Hope this helps! Here's my source: visualgdb.com

Bexolo
  • 197
  • 1
  • 9
  • I can confirm that this works. I'm an android developer and I've had same issue with Xiaomi, HTC and OnePlus 6T devices. Their official driver often does not provide ADB compatibility. You just have to explicitly install universal Google's driver for ADB. If you do everything correctly you will see a dialog window on your devices asking you to accept debugging from the particular computer with the given ID. Unless you confirm it you wont be able to debug the app. – Kirill Karmazin Oct 17 '19 at 11:10
  • Looking at lengthy steps, don't go for other answers with workarounds! This works perfectly! – Virat18 Mar 19 '20 at 14:09
10

I got it to work:

It turns out when your device is connected through Media Device (MTP), ADB will not be able to communicate. In this case, you have to connect as a Camera (PTP) for it to work. Super annoying, but an easy fix if anyone happens to have this same issue.

mattrick
  • 3,580
  • 6
  • 27
  • 43
3

I think the problem is due to ADB driver.

I also faced the same problem with micromax tab.

Try universal ADB driver. Install it and check.

Bala Pravin
  • 101
  • 5
  • Would you happen to have a link to one? I've tried multiple, including [this one](http://adbdriver.com/downloads/). – mattrick Dec 21 '15 at 08:12
3

After spending hours, this worked for my OnePlus5 on Ubuntu 16.04

  1. Enable the developer option and USB debugging in device
  2. Attach device to laptop
  3. Get 4 digit device id to add in udev rules. Look - https://reactnative.dev/docs/running-on-device
  4. Make sure below given line added in /etc/udev/rules.d/51-android.rules, 2a70 must be replaced by your device id SUBSYSTEM=="usb", ATTR{idVendor}=="2a70", MODE="0666", GROUP="plugdev"
  5. sudo chmod a+r /etc/udev/rules.d/51-android.rules
  6. Change “USB used for” setting to MIDI in your device
  7. Run sudo adb kill-server && sudo adb start-server
  8. adb devices now showing my device
Rakesh Shekhawat
  • 348
  • 4
  • 15
1

Go to your device manager, right click the phone and click update driver. There should be an option to select the driver from a list. Find Universal ADB Device on the list and select that.

  • It actually didn't even appear in my device manager, until I changed it to PTP. At that point, it worked fine. – mattrick Dec 21 '15 at 23:57
1

None of the existing answers worked for me as I was trying to access my OnePlus 6T using adb on my Ubuntu machine. I then spotted that, with USB Debugging turned off, the laptop was mounting a read-only partition from the phone that included a Windows executable, a Mac OSX .dwg file, and a linux .sh script. Running the linux script and re-enabling USB Debugging then allowed adb to detect the phone.

I'll paste the shell-script below for completeness, but the main thing it's doing is adding the string 0x2a70 to the file ~/.android/adb_usb.ini and then restarting the adb daemon.

# adb configuration script
PATH=$PATH:/bin:/sbin:/usr/sbin
ANDROID_HOME=~/.android
ANDROID_CONFIG=~/.android/adb_usb.ini
CUST_VID="0x2a70"
if [ -e $ANDROID_HOME ] ; then
   echo "android home is exist!"
else
   echo "creat android home!"
   mkdir $ANDROID_HOME
fi
grep $CUST_VID $ANDROID_CONFIG 2>/dev/null
if [ $? -eq 0 ] ; then
   echo VID $CUST_VID is already configured.. 
   echo "adb should be OK!"
   exit 0
else
   echo config adb ...
   echo $CUST_VID >> $ANDROID_CONFIG
fi
adb kill-server
if [ $? -eq 0 ] ; then
  echo "OK! You can use adb now!"
  exit 0   
else
   echo "try sudo exec adb.."
   sudo adb kill-server
   if [ $? -eq 0 ] ; then
       echo "OK! You can use adb now!"
       exit 0
   else
       echo "Please do command \"adb kill-server\""
   fi
fi
exit 0
dfluff
  • 11
  • 2
0

Well in my case, I just followed this video: https://www.youtube.com/watch?v=wXtbAMarHQw

And if in case, while selecting for the Device Drivers your Device Manufacturer Name doesn't show up.. Don't worry got to Google and select Google Composite ADB Driver Interface and select it.

This procedure worked for me!!

KNDheeraj
  • 834
  • 8
  • 23
0

use Automated installation http://adbdriver.com/downloads/

worked for me.

Alok
  • 361
  • 3
  • 4
0

Make sure the cable is properly connected to your phone.

I know this sounds stupid, but this is what happened to me. I'm using a new phone case and when I connected the cable, phone was charging, but not visible for ADB. I found out that the cable is not fully plugged into the phone. When I took the phone out of the case, everything started to work as expected.

Micer
  • 8,731
  • 3
  • 79
  • 73
0

Try this out if above options doesn't work:

  1. List item
  2. Open Developer options
  3. Revoke USB authorisations
  4. Turn off USB debugging
  5. Reconnect USB cable
  6. Turn on USB debugging
  7. Try running the app > It shall open up a popup on the device asking permission.
  8. Allow
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
sagarpatidar
  • 1,532
  • 1
  • 16
  • 19
0

Enable the following options in one plus device. we can access ADB commands

  • Enable developer options
  • Turn on USB debugging

By doing these following instructions, adb command can be used without even rooting the device