How to Add Udev Rules for USB Debugging in Linux
In Linux, when connecting devices for debugging, an error message is displayed:
insufficient permissions for device: user in plugdev group; are your udev rules wrong?
Or the reply from ADB logcat is always waiting. Even if the terminal is connected, the reply from ADB device is to give permission error.
$ adb logcat - waiting for device - ^C $ adb devices List of devices attached ???????????? no permissions
The solution is to find the bus and device ID assigned by the kernel:
$ lsusb Bus 001 Device 041: ID 05c6:9025 Qualcomm, Inc. Qualcomm HSUSB Device
Add a udev rules file that contains the USB configuration for each device type you want to develop. In the rules file, each device manufacturer is identified by a unique vendor ID specified by the ATTR{ID vendor} attribute. Set device detection on Ubuntu Linux as follows:
Log in as root and create this file: /etc/udev/rules.d/51-android.rules, or vim /etc/udev/rules.d/51-android.rules Use this format to add each vendor to the file: SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev"
In this case, the vendor ID is Qualcomm's. Mode assignment specifies read/write permissions. A GROUP defines which UNIX group owns the device node.
Now execute:
$ chmod a+r /etc/udev/rules.d/51-android.rules
$ adb kill-server
Connect successfully:
$ adb devices List of devices attached WP17451Q20003163 device
Please refer to https://developer.android.com/studio/run/device.html#developer-device-options