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.
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'.
I found a simple answer that worked for me:
adb kill-server
sudo adb start-server
sudo adb devices
You will find your device then.
Reference: http://itsfoss.com/fix-error-insufficient-permissions-device/
It's simple.
Just change your USB mode to File Transfer mode then it works.
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
Android 9
With Android 9 use the option File Transfer.
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.
IN my phone Symphony W75,
in option USB computer connection-> selecting Connect as Media device(MTP) has solved the problem.
Long to short,
I had the same problem with a Prestigio PMP5570C tablet,
all you have to do is to confirm on your tablet that you want to copy data to/from your computer (what i forgot), and add the 2 lines that #portsample wrote.
You can find the idVendor of your device typing
lsusb
in UBUNTU 12.04, then you get:
Bus 001 Device 011: ID 2207:0010,
where 2207 is your vendor id.
Summed up the question and answer...
I updated my device (Nvidia Shield) that was previously connecting fine, so I knew that the PC setup is correct already. The developer settings seem to have a new layout on Android 7.0.
It is under Settings > Preferences > Developer options > Networking > Select USB configuration
Here, I needed to select PTP and everything works fine again:
Enable USB debugging
Use USB to transer file
This procedure solves the problem for me:
- On the Android device, drag the top menu and select "USB for file transfer"
- Press "Run" again
Go to Developer Options -> Default USB Configurations and Change to PTP
Run these two commands in terminal
sudo adb kill-server
sudo adb start-server
Should Work!
I made a script for this error. For me it works fine in Fedora 28, but it should work in many Linux distributions.
Just create a file with the content of the selfexpanied script. I called it usbDebbugingAndroidStudio.sh
Give him execution permission with: chmod +x usbDebbugingAndroidStudio.sh
And run it: sudo ./usbDebbugingAndroidStudio.sh
After that check the list displayed by the command lsusb and introduce the Id of
your device.
For example:
My output was: Bus 006 Device 002: ID 05c6:9091 Qualcomm, Inc.
So I type 05c6 and press enter.
The script:
#!/usr/bin/env bash
#This script configure Android Debug Bridge permissions to solve the following
#error: com.android.ddmlib.AdbCommandRejectedException: insufficient permissions for device
#This error is produced when you try to install an APK from Android Studio in your device.
#You can check the vendorId here:
#https://developer.android.com/studio/run/device#setting-up
#If your device's brand isn't listed check the info displayed by the command lsusb
lsusb
#My output was:
#Bus 006 Device 002: ID 05c6:9091 Qualcomm, Inc.
#The id for this line is 05c6
echo -n "Enter the id of your mobile device: "
read usbProviderId
cd /etc/udev/rules.d/
sudo touch 51-android.rules
(
sudo cat << _EOF_
SUBSYSTEM=="usb", ATTR{idVendor}=="$usbProviderId", MODE="0666", GROUP="plugdev"
_EOF_
) | sudo tee 51-android.rules
#Give read and write permissions to the file
sudo chmod a+r /etc/udev/rules.d/51-android.rules
#Kill the Android Debug Bridge server to restart it
cd $HOME/Android/Sdk/platform-tools
sudo ./adb kill-server
#If this still doesn't work unplug the usb cable and connect again.
#And repeat the last step Kill the ADB server.
What the F... ! :)
Note : I have seen it on android 8.1 on a One+5t...
Even we do all of above, it is necessary to make something on your android device .. in addition to go in dev options menu (usb debug) (don't hesitate to reset "cancel authorization" or something like this (I am in french version ;) )
If some people meet the same problem than me, maybe it could be usefull for you too :
Don't forget to authorize devices in your phone (each time of usb connect on the android device if you don't select always box). Beside, you can suppress the old authorized devices on your phone and start with proper parameter to authorize clearly your pc on your android device
When you connect the android device, a pop up or notification ask to authorize a mac address or equivalent to the device : authorize it if you want to authorize connection between your linux pc and your android device.
It is necessary to obtain autorisation on your android device when you use connect the usb cable (if you don't accept all the time but if it is the first time this box is going to appear on your devices) if you don't do it, adb devices show unauthorized even all rights are good (666, UDEV etc)
Note : thank you for your precious help.
A last thing, sorry for my english
I'm facing this issue while run flutter app from android studio 4.1, i did remove usb cable and plug into second usb port and its working :),
I'm writing this if someone face same issue then they can get help.
Same issue on Fedora 32, to fix this try this:
adb kill-server
adb start-server
For me and possibly many others the issue is to do with access rights to devices on the machine. Now that this is well documented in the android documentation, I think the best solution is here
On Debian based Systems you can run lsusb or dmesg to get vendor id if your vendor does not exist on the given list
I have face the same problem and i have resolved this by
Adding the path of your_android_sdk_path to the environment variable like
sudo export $PATH:/your_android_sdk_path/platform-tools/adb
its your wish how you want to add this to your account or system wide by editing these file ~/.bashrc file or ~/.profile
or
/etc/profile, /etc/bash.bashrc, or /etc/environment if u want to add to system wide access.
and then create the link of that in bin
sudo ln -s /your_android_sdk_path/platform-tools/adb /bin/adb
if you have used adb devices or any command then first kill the server like
adb kill-server
then start the server like
adb start-server
adb devices
now you can see your devices are listed properly without an issue
As the error message said, it is a permission insufficient problem. In my experience, it only happened on my Linux machine, and works well on MacOS and Windows. Launching your Android Studio with root permission could avoid this problem.
$sudo /your_android_studio_path/bin/studio.sh
In my situation:
cd /etc/udev/rules.d/
sudo chmod a+r ./*.rules #the name of your rules files.
Then,I can use adb without this error.
if accepted answer not worked for you then just simple follow steps:
Just open your android studio terminal:-
adb kill-server
adb start-server
it worked for me.
Without running Linux
sudo apt-get install adb. Don't forget to enable USB debugging.
Ref: https://developer.android.com/studio/run/device
I have a bash script running in work which automates the install of various APK samples (some malicious, some not - for testing purposes) to a HTC Desire Z handset running Sophos AV.
Runs well but every now and then an APK will try to install and the shell prompt will just hang at install. At the same time Sophos detects it as malicious but instead of displaying a box offering to uninstall it, it displays a box to delete it instead. Whether this is connected to the adb install issue I'm not sure but it's happened everytime.
It appears to install ok (2539 KB/s (634874 bytes in 0.244s)) .Package size is 640k.
I am running the command adb install -s /location/of/sample.apk
Any ideas?
Sorry for the lengthy post
Thanks
In case this helps others I had a different problem with similar symptoms. ADB install -r "apk path" would hang indefinitely.
I troubleshooted a myriad of things and identified that it was my USB cable length.
I have an USB extender cable as that I plug my devices into. The combined length of my device's cable and the USB extender cable caused this issue. Removing the extension cable fix the issue and eventually I replaced my USB extender cable with a shorter extension cable for the final solution.
try restarting adb server:
adb kill-server
adb start-server
Have you added udev rules file that contains a USB configuration for type of device you want to use.Incase you havn't that may be a reason for this issue. Execute 'lsusb -v' in Terminal. This will give information regarding Unique Vendor id of each connected device in a list.Find the Vendor id of your device.Once you identify the vendor id follow the instructions given in the link for Ubuntu environment. link:http://zoumpis.wordpress.com/2013/06/09/using-hardware-devices-while-developing-and-android-application/
I've been developing my first android apps on Eclipse installed on OSX Lion. I would like to use my Jelly Beans Galaxy Nexus for debugging, but the Android Device Bridge (adb) can't find the device:
./adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
The phone is in debugging mode.
The phone is recognizable as a camera (PTP), but not as a media device (MTP). ADB does not work regardless of PTP\MTP setting.
I have restarted noth the phone and the mac
Following this advice, I've installed Android File Transfer. The ATF recognizes the device, but no luck with the ADB.
Any ideas?
Addendum: I have reported a bug for this. Workarounds are still most welcome!
Sep 5 13:28 UTC - Workaround #1: Dropbox: I've moved the OSX Eclipse workspace to Dropbox and installed Dropbox on the device. The APK is written to bin/, and I re-install it from the Dropbox app after each successful build.
I'm answering this because my boss just had the exact same issue with his Galaxy Nexus, and we finally fixed it yesterday. He had an application, "EasyTether" that was snagging his connection to ADB and it couldn't be used anywhere else. Is it possible that you've setup this application, or a similar one that might be using ADB for you? If "Android File Transfer" works (it was working in parallel with EasyTether for my boss), then your connection is active, so as long as "USB Debugging" is enabled in your settings, you should be seeing a connection. Here's a quick how-to in the event that you do have "easytether"
BEFORE you plug your phone in run the following in terminal
sudo kextunload /System/Library/Extensions/EasyTetherUSBEthernet.kext
If that fixes the issue, and you want to remove easytether altogether, you can us the rm command with the -rf flags to keep it from happening again...
sudo kextunload /System/Library/Extensions/EasyTetherUSBEthernet.kext
sudo rm -rf /System/Library/Extensions/EasyTetherUSBEthernet.kext
You can use adb over wifi.
See this post to do it yourself.
or there are quite a lot of apps on google play. But these need root access
Try taking the usb stick out of the phone and put it back
Try taking it out of the mac and put it back
Try to put the stick in another port
Try to wriggle the stick so you are sure it is connected.
There is a long discussion with possible solutions here: Can't find android device using "adb devices" command
Have you tried a different cable? I ordered a bunch of cheap cables off of eBay, and the first one I used would not work for adb. It did work for charging and file transfers however.
I'm trying to install my test app on my device, but I does not go there.
I've also prepared my phones as described here: here
1 - In eclipse I see the device with '??????????' as ID.
2 - with adb device, I get:
List of devices attached
???????????? no permissions
I edited the /etc/udev/rules.d/51-android.rules....not sure what else to do?
3 - I copies the app to my SD card and tried to installed it from there ... but at a point the installation stopped and the message was 'Application not installed'
Also! The app gets intalled on my friends phone via eclipse?
Can anybody give me a hand with this???
Thanks!
Ensure your machine is connected to the Phone device correctly..
If the error persists, you can try restarting the adb server, using following commands:
adb kill-server
adb start-server
adb devices
If the error still persists, try restarting both your development machine and phone device.
I've seen that before when the user you are running as did not have permissions. If you're using Ubuntu try running adb via sudo:
sudo adb devices
If you're using another distro either try as root, or use sudo, accordingly. (Assuming you're using Linux, and probably Ubuntu, if you're in that part of the instructions on the page you linked -- but that info in the question would help too.)
Also make sure you're using the correct vendor ID for the device you're trying to use. The instructions show 0bb4 as an example only (that will only work for certain HTC devices). You can use the lsusb command to check to make sure you're device is detected by the OS, and get the correct ID.
lsusb
Bus 002 Device 100: ID 18d1:4e12 Google Inc. Nexus One Phone (Debug)
absolutely beyond my comprehension - the device got found (recognized) after deselecting the Settings > Applications > Development > USB debugging....
:) I signed with relief ...
Thank you very much for the enthusiasm and help!
I can't get adb to recognising my HTC Desire on my new upgrade of Ubuntu 10.10 Maverick Meerkat.
adb devices shows
List of devices attached
???????????? no permissions
Now, there are plenty of tutorials for changing rule files under /etc/udev/rules.d/.
However, I cannot find one specific for 10.10.
Can anyone tell me whether the rule file name and content is the same as described at link text, or are we looking at some new settings for this new release?
Many thanks
On Linux Mint/Ubuntu 11.04 with a Samsung Galaxy S2, I didn't use any rules, but when "reset adb" or when "Devices view" it shows:
???????????? no permissions
I had to :
sudo killall adb # if I don't, I get "error: insufficient permissions for device"
sudo ./adb usb
Then I was able to take screenshots following this tutorials: http://www.addictivetips.com/mobile/how-to-take-screenshots-of-android-device/
Cheers
My magic spell for Ubuntu 11.04:
$killall adb
$sudo adb usb
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
restarting in USB mode
Then go to eclipse and start debugging on real device
Ok I am a little late to the party but here is another approach...
Create a file called 51-android.rules in /etc/udev/rules.d with the following contents
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
Then run the following command to reload the udev rules ...
udevadm control --reload-rules
Now plug in your galaxy S2 mobile phone into the computer's USB port and run adb devices.
NOTE: You will need to change the vendor id (highlighted in bold) to match your phone's vendor id (in the OP's case it should be 0bb4 for HTC)
Okay, I guess the tutorials work, I created both 70-android.rules and 51-android.rules, re-typed them again (get rid of the funny quotes when you copy from the web).
Restart
And now it is recognised!
On windows, I had to download a Special App from HTC in order to get the proper USB drivers to connect to my Evo. The app in question allows you to synch your outlook contacts/calendar (weee...) with those on your phone. I rather doubt there's something similar available for ubuntu/Linux.
I strongly suspect you're up against a similar situation. The standard USB drivers don't work with HTC phones, so you need Something Else.
If this is something that stopped working with the upgrade, you'll need to take a close look at any USB-related changes.
Good luck.
Hi all i am very frustrated by checking all sides
But one day i got the solution of this problem pls follow the following steps
First open your device terminal
1)on the top left hand corner in Application ->Accessories->terminal
2) on terminal window type following commands
$ sudo su then press enter after that terminal want password which is set by you
in installation or giving at the time of logging.
$<Enter password> password is not shown but it is type internally you can just type
whole password
$ mkdir ~/.android
$vi ~/.android/adb_usb.ini
press ctri+z here
$ echo "0x0451" > ~/.android/adb_usb.ini
$cat /root/.android/adb_usb.ini
$sudo mount -t usbfs none /proc/bus/usb
$cd path of android sdk tools from home
like /home/tv-014/Desktop/newandroid/android-sdk-linux/platform-tools
in my system i have put android-sdk-linux at desktop and in it one platform-tools
folder contain the adb.exe file
so after cd command we have the path from home to platform-tools folder.
$ ./adb kill-server
$ ./adb start-server
$ ./adb devices
Now you got the list of devices attach to your systems.