Five days ago I installed Android Studio on a fully updated Ubuntu 2018.04, used the wizard to create an example app, pressed the "Run" button and it ran perfectly on my Android device connected via USB.
Today, on the same Ubuntu and with the same deviced plugged in, I opened the same project and pressed "Run" again. It now fails:
Launching Application
$ adb push /home/nico/src/ActionBarCompat-Basic/Application/build/outputs/apk/debug/Application-debug.apk /data/local/tmp/com.example.android.actionbarcompat.basic
com.android.ddmlib.AdbCommandRejectedException: insufficient permissions for device: user in plugdev group; are your udev rules wrong?
See [http://developer.android.com/tools/device.html] for more information
Error while Installing APK
I did not knowingly modify any Ubuntu configuration or even update the OS.
What could be the problem?
How to investigate further?
This procedure solves the problem for me:
It might be accidental, but it has always (about 50 times) worked so far.
In recent versions of Android, the name of the menu and choice item has changed a bit, but it still works for me.
In short: The group of the USB device is
root
, notplugdev
.Adding a file
/etc/udev/rules.d/51-android.rules
(
lsusb
→18d1:d002
)And plugging in and out did the work for me. Now, the device is in the
plugdev
group.(source)
I was receiving a similar error due to udev rules not being configured:
I was able to work around this by running:
but this was not at all ideal. I fixed it by installing:
Which is a community-maintained default set of udev rules.
source
Complet Instruction Ubuntu 18 + Android 10
This is how I did
You can now see the new device added to the device list.
Copy the device ID from the terminal. ID is shown as the first part: second part
For Example,for below device ID here is 2a70:4ee7
Edit the Udev rules using nano
sudo nano /etc/udev/rules.d/51-android.rules
Add this line at the bottom of the file. Replace 2a70 and 4ee7 with your first and second part of your device ID
Y to Yes
Now reload dev rules
That's it it should be working now
As one of them mentioned, removing the USB cord from the laptop and re-connecting it did the trick for me. (I may have enabled the
USB Debugging
option after I connected it the first time, hence the error)