Android - OnePlus does not work over ADB
Asked Answered
T

12

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.

Tolerable answered 21/12, 2015 at 6:26 Comment(2)
It would help to know what OS/Machine model you are using (Win 7,Win 8, Win 10/Mac/Linux)?Hygroscopic
@MorrisonChang I'm running Windows 10.Tolerable
T
12

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.

Tolerable answered 21/12, 2015 at 22:56 Comment(0)
D
13

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

Disgraceful answered 12/12, 2016 at 23:35 Comment(2)
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.Malformation
Looking at lengthy steps, don't go for other answers with workarounds! This works perfectly!Sharp
T
12

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.

Tolerable answered 21/12, 2015 at 22:56 Comment(0)
H
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.

Hough answered 21/12, 2015 at 7:16 Comment(1)
Would you happen to have a link to one? I've tried multiple, including this one.Tolerable
P
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
Predate answered 9/5, 2020 at 12:52 Comment(0)
P
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.

Physic answered 21/12, 2015 at 23:33 Comment(1)
It actually didn't even appear in my device manager, until I changed it to PTP. At that point, it worked fine.Tolerable
C
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
Clubwoman answered 2/3, 2019 at 12:37 Comment(0)
A
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!!

Altercation answered 8/6, 2018 at 7:24 Comment(0)
L
0

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

worked for me.

Lean answered 24/7, 2018 at 5:34 Comment(0)
L
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.

Legal answered 24/11, 2018 at 14:0 Comment(0)
P
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
Painting answered 4/6, 2019 at 9:41 Comment(0)
C
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

Charlyncharm answered 18/1, 2020 at 17:39 Comment(0)
S
0

I got it to work by:

  1. Enable Developer Options
  2. Go to Default USB configuration and choose File transfer / Android Auto

Windows and Android Studio recognized the phone immediately after doing that.

For some reason, the popup asking what to do with the connected device wasn't showing in Windows 10 when plugging in the USB cable, setting the USB configuration manually on the phone made Windows recognize the device.

Seko answered 30/5, 2024 at 11:8 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.