Insufficient permissions for device in Android Studio Workspace running in openSUSE 13.2
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
- Open the developer options
- Enable USB debugging.
- change USB connection to PTP
Steps on Linux
- on console run
sudo usermod -aG plugdev $LOGNAME
- on console run
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.
portsample
Give someone a program, frustrate them for a day. Teach someone to program, frustrate them for a lifetime.
Updated on January 06, 2022Comments
-
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 about 9 yearsYes, 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 about 8 yearsI 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 over 7 yearsThis file doesn't exist for me, using Elementary OS Freya
-
BenRoob almost 7 yearsI have just created this file on Ubuntu 14.04 for a Huawei device. Works perfect! Thanks for this answer!!
-
rrosa almost 7 yearsi had to restart the adb server after this to get
adb shell
to work -
jamie over 6 yearsThat is strange but it is the case. Not sure if I have to mount the device or not.
-
tonisives over 6 yearsworked 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 about 6 yearsOn my Pixel XL, I had to choose "Use USB to transfer photos (PTP)".
-
ffonz about 6 yearsEven with Android Studio (3.0.1) I had to enable MTP.
-
Lucio Paiva over 5 yearsOn Android 8, this option can be found under Developer options -> Networking -> Select USB Configuration: MTP (Media Transfer Protocol).
-
Aananth C N over 5 yearsI 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 about 5 yearsI found more details in this answer at the Ask Ubuntu Stack Exchange.
-
Fedorov7890 about 5 yearsWorks on Android 4.4
-
Confused about 5 yearsFor MotoG6 I have to select "Use device as MIDI"
-
Don Smith almost 5 yearsTo 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 almost 5 yearsThis Answer worked for me. For Xiaomi Mi A2 Setting->Connected devices->USB->Select File Transfer.
-
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 almost 4 yearsThis worked for me too. I am using Ubuntu with Xiaomi Redmi Note 5. Just choose File Transfer instead of the default "Charging" mode.
-
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 about 3 yearsWorks with Ubuntu, Flutter.