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 a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer is identified by a unique vendor ID, as specified by the ATTR{idVendor} property. To set up device detection on Ubuntu Linux:
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 example, the vendor ID is for Qualcomm. The MODE assignment specifies read/write permissions, and 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 reference to https://developer.android.com/studio/run/device.html#developer-device-options