mattrick
mattrick

Reputation: 3910

Android - OnePlus does not work over ADB

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.

Upvotes: 7

Views: 22552

Answers (12)

Daniel Hansen
Daniel Hansen

Reputation: 1

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.

Upvotes: 0

Rakesh Shekhawat
Rakesh Shekhawat

Reputation: 358

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

Upvotes: 3

visahan ashok
visahan ashok

Reputation: 11

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

Upvotes: 0

sagarpatidar
sagarpatidar

Reputation: 1602

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

Upvotes: 0

dfluff
dfluff

Reputation: 31

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

Upvotes: 1

Micer
Micer

Reputation: 8979

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.

Upvotes: 0

Alok
Alok

Reputation: 391

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

worked for me.

Upvotes: 0

KNDheeraj
KNDheeraj

Reputation: 852

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!!

Upvotes: 0

Bexolo
Bexolo

Reputation: 307

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

Upvotes: 13

Sumit Kukreja
Sumit Kukreja

Reputation: 59

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.

Upvotes: 1

mattrick
mattrick

Reputation: 3910

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.

Upvotes: 12

Bala Pravin
Bala Pravin

Reputation: 101

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.

Upvotes: 3

Related Questions