Saturday, June 7, 2014

Set up android devices for development in Ubuntu Linux (and fix the no permissions error)

  1. Enable USB debugging
  2. Set up udev rules. sudo vi /etc/udev/rules.d/51-android.rules , and add the following content (replace 'kaiyin' with your own username, of course):
    Double click to toggle code
            SUBSYSTEM=="usb", ATTRS{idVendor}=="054c", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", USER="kaiyin", GROUP="plugdev"
            SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", USER="kaiyin", GROUP="plugdev"
            
  3. sudo service udev restart
  4. If you have already started the adb server, kill it
  5. Now you should be able to see your device by running sudo adb devices

I am wondering how google's documentation page can be so lousy that people actually have to figure this out for themselves, I am further wondering why there isn't a script to do all this automatically, considering making such a script is quite easy.

0 comments: