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

后端 未结 26 2072
再見小時候
再見小時候 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:19
    1. Follow the instructions at http://developer.android.com/guide/developing/device.html(Archived link)
    2. Replace the vendor id of 0bb4 with 18d1 in /etc/udev/rules.d/51-android.rules

      Or add another line that reads:

      SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
      
    3. Restart computer or just restart udev service.
    0 讨论(0)
  • 2020-11-22 13:21

    I know this might be a little late but here is a very good article on how to manually add Android ADB USB Driver. Manually adding Android ADB USB driver in Ubuntu 14.04 LTS

    Edited to Add Link Content

    Steps

    Note: Make sure that you have connected your Android device in USB Debugging mode

    Open terminal (CTRL + ALT + T) and enter command: lsusb

    Now you might get a similar reply to this:
    Bus 002 Device 013: ID 283b:1024

    Note: With reference to this Bus 002 Device 008: ID 283b:1024
    {idVendor}==”283b” {idProduct}==”1024″

    Now enter the following command: sudo gedit /etc/udev/rules.d/51-android.rules
    This creates the android rules file (51-android.rules) or open the existing one in the specified location (/etc/udev/rules.d)

    Add a new line to this file:
    SUBSYSTEM==”usb”, ATTRS{idVendor}==”283b”, ATTRS{idProduct}==”1024″, MODE=”0666″

    Note Edit idVendor & idProduct values with your device values. Save and close.

    Now enter the following command:
    sudo chmod a+rx /etc/udev/rules.d/51-android.rules - grant read/execution permission
    sudo service udev restart - Restart the udev service

    Now we have to add the idVendor to adb_usb.ini. Enter the following commands:
    cd ~/.android
    gedit adb_usb.ini

    Add the following value 0x283b

    This is nothing but 0x(idVendor value). So replace the value with. respect to your device value Save and close the file.

    Now enter the following command:
    sudo service udev restart

    Plug out the Android device and reconnect it again.
    Now enter the following command:
    adb kill-server
    adb devices

    There you go! Your device must be listed.

    Copied From Manually adding Android ADB USB driver in Ubuntu 14.04 LTS

    Worked for me.

    0 讨论(0)
  • 2020-11-22 13:24

    What works for me is to kill and start the adb server again. On linux: sudo adb kill-server and then sudo adb start-server. Then it will detect nearly every device out of the box.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-11-22 13:24

    I had the same problem with my Galaxy S3. My problem was that the idVendor value 04E8 was not the right one. To find the right one connect your smartphone to the computer and run lsusb in the terminal. It will list your smartphone like this:

    Bus 002 Device 010: ID 18d1:d002 Google Inc.
    

    So the right idVendor value is 18d1. And the line in the /etc/udev/rules.d/51-android.rules has to be:

    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" 
    

    Then I run sudo udevadm control --reload-rules and everything worked!

    0 讨论(0)
  • 2020-11-22 13:24

    You should NOT run adb server as root as other answers are suggesting. Instead if you are using Arch Linux do the following:

    1. Install the android-udev package with Pacman
    2. Reload udev rules:

      # udevadm control --reload-rules
      
    3. Add yourself to adbusers group and then logout and login:

      # usermod -aG adbusers $LOGNAME
      

    Source: https://wiki.archlinux.org/index.php/android#Configuring_adb

    0 讨论(0)
提交回复
热议问题