Insufficient permissions for device in Android Studio Workspace running in openSUSE 13.2

110,764

Solution 1

Changing permissions in this line from /etc/udev/rules.d/51-android.rules,

#Motorola 
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0664", GROUP="plugdev"

to,

#Motorola 
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666", GROUP="plugdev"

resolves this issue in a manner that DOES NOT require running adb as root.

Solution 2

I had this while using a Linux machine with a Nexus 4 running Android 5.1

The fix was to enable both 'debug over USB' and 'connect as MTP'. The opposite is true when using the same device and Android Studio and adb on OSX though - to allow Android Studio to recognise the handset, I need to disable 'connect as MTP'.

Solution 3

It's simple. Just change your USB mode to File Transfer mode then it works.

Solution 4

Android 8

MTP is no longer available. On my android 8 "Transfer Files" option did not work.

"Transfer photos PTP" Is worked, and Studio showed the device name.

  • Steps on your cell phone

    1. Open the developer options
    2. Enable USB debugging.
    3. change USB connection to PTP
  • Steps on Linux

    1. on console run sudo usermod -aG plugdev $LOGNAME

Android 9

With Android 9 use the option File Transfer.

Solution 5

IN my phone Symphony W75, in option USB computer connection-> selecting Connect as Media device(MTP) has solved the problem.

Share:
110,764
portsample
Author by

portsample

Give someone a program, frustrate them for a day. Teach someone to program, frustrate them for a lifetime.

Updated on January 06, 2022

Comments

  • portsample
    portsample over 2 years

    I have a rooted Motorola Defy+ running a Cyanogenmod v11 custom ROM (nightly build) created by Quarx. Using Android Studio Workspace,(ASW) v.1.1.0, when I try and debug on this device, I get

    ????????????[null]
    

    listed in the Choose Device window, with the Logcat window showing

    insufficient permissions for device
    

    I would really like to use this device and ROM for debugging purposes.

    When I enter lsusb from the command line I get,

    Bus 002 Device 002: ID 22b8:431d Motorola PCS
    

    This is the correct device id for Motorola units. I have installed 51-android.rules and 71-android.rules in /etc/udev/rules.d/ with the correct Motorola ids in these files.

    I've also tried Revoke USB debugging authority, from Developer Options on the device, with no luck.

    I have not tried running ASW as root hoping that there might be another option; is there?

    Update: I was able to get in and access ADB by

    uvachem-gsmith2:/home/greg/Android/Sdk/platform-tools # ./adb
    

    I then did a kill server, did an SU to root user and restarted the server. I then tried to connect to the device from Android Studio. Got a message on the device about accepting the RSA key from the PC, said "Yes" and then was able to deploy the app to the device. So back to my original question, Is there another way to access this device without logging in as root? It seems as if there is a permission issue on the phone file system that is preventing this...

    Update #2 The core problem here was a permission thing. Even though running ADB as root will allow access to the rooted Android device, a better solution is to change permissions in the udev file for this device...resetting 664 to 666, (see answer below). This allows the PC to access the file system on the device.

  • Chris Stratton
    Chris Stratton about 9 years
    Yes, if you give permissions to all users that will work, but your rules files is designed based on the idea that what you are supposed to do is add your user account to the plugdev group, log out, and then log back in - that gives you the "group" 6 in the original 0664.
  • BMB
    BMB about 8 years
    I ran into similar behavior on the same development environment with two different devices, and felt it is worth mentioning to anyone led to this post as I was. I have an LG Realm that only works in Android Studio (running on Linux Mint) if I connect using MTP, and an LG Logos that only works when I connect using PTP. So it might be worthwhile to tinker with both options for any troublesome device. Odd indeed, took me over an hour to figure that out just now...
  • Mark O'Sullivan
    Mark O'Sullivan over 7 years
    This file doesn't exist for me, using Elementary OS Freya
  • BenRoob
    BenRoob almost 7 years
    I have just created this file on Ubuntu 14.04 for a Huawei device. Works perfect! Thanks for this answer!!
  • rrosa
    rrosa almost 7 years
    i had to restart the adb server after this to get adb shell to work
  • jamie
    jamie over 6 years
    That is strange but it is the case. Not sure if I have to mount the device or not.
  • tonisives
    tonisives over 6 years
    worked for me but first had to create the file because it didnt exist and then change the idVendor to what it is in lsusb(see greg93 answer). This should not be part of starting developing on linux.
  • yohosuff
    yohosuff about 6 years
    On my Pixel XL, I had to choose "Use USB to transfer photos (PTP)".
  • ffonz
    ffonz about 6 years
    Even with Android Studio (3.0.1) I had to enable MTP.
  • Lucio Paiva
    Lucio Paiva over 5 years
    On Android 8, this option can be found under Developer options -> Networking -> Select USB Configuration: MTP (Media Transfer Protocol).
  • Aananth C N
    Aananth C N over 5 years
    I created this file in Ubuntu 18.04, added support for Qualcomm. Then reloaded all rules, unplug and re-plugged the USB cable, it worked!!
  • dan-gph
    dan-gph about 5 years
    I found more details in this answer at the Ask Ubuntu Stack Exchange.
  • Fedorov7890
    Fedorov7890 about 5 years
    Works on Android 4.4
  • Confused
    Confused about 5 years
    For MotoG6 I have to select "Use device as MIDI"
  • Don Smith
    Don Smith almost 5 years
    To be clear, you make this change on the device. On my OnePlus it is in Settings > Developer Options > Select USB Configuration > MTP (Media Transfer Protocol)
  • Saleh Enam Shohag
    Saleh Enam Shohag almost 5 years
    This Answer worked for me. For Xiaomi Mi A2 Setting->Connected devices->USB->Select File Transfer.
  • José
    José over 4 years
    @cro Thanks for this! Saved my day as I was having the same issue in Arch Linux. Apparently, any form of file transfer you select in your device will do the trick. The default and safe (if not in use) 'no data transfer' won't work - and makes total sense. This thought comes based on tests I just made with my Moto G7 Play.
  • rahmatns
    rahmatns almost 4 years
    This worked for me too. I am using Ubuntu with Xiaomi Redmi Note 5. Just choose File Transfer instead of the default "Charging" mode.
  • Doc
    Doc over 3 years
    +1. Works great. This is the only method which allows you to have internet from the device as RNDIS and debugging on the same device at the same time. Refer to askubuntu.com/a/349191/572578 for more details. If you have 2 or more devices just add the line mentioned above for each of the devices in the same file which is 51-android.rules. Make sure to put the id from lsusb command for each device. Check the link mentioned to get the id.
  • Eray Erdin
    Eray Erdin about 3 years
    Works with Ubuntu, Flutter.