set up device for development (???????????? no permissions)

后端 未结 26 2071
再見小時候
再見小時候 2020-11-22 12:27

I am using a Samsung galaxy nexus phone (Android 4.0 platform) .

I am developing Android app on Ubuntu linux OS. I would like to run my application

26条回答
  •  花落未央
    2020-11-22 13:24

    There are a lot of bad answers posted to this question ranging from insisting on running adb as root (which should not be touted as the only or even recommended solution) to solving completely unrelated issues.

    Here is the single shortest and most universal recipe for taking care of permissions for all adb and fastboot devices at once:

    echo 'ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:ff420?:*", MODE="0666"' | sudo tee /etc/udev/rules.d/99-android.rules
    sudo udevadm control --reload-rules
    sudo udevadm trigger --verbose --action=add --subsystem-match=usb
    

    Or you could use slightly longer version I posted to this gist.

    As for the specific thing that OP did wrong in his question - it was not reloading the udev rules after editing the .rules file.

    Also OP did not tell which Android build (aka ROM) he had on his phone. The idVendor value is set in software and therefore it depends on the ROM. So the value of 04E8 he used in his original rule would have worked only for devices with Samsung stock ROMs. But this is not a problem for this udev rule - it matches all devices with adb or fastboot interfaces regardless of their VendorID.

提交回复
热议问题