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

后端 未结 26 2023
再見小時候
再見小時候 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:02

    I had the same problem and I followed these steps:

    # Clone this repository
    git clone https://github.com/M0Rf30/android-udev-rules.git
    cd android-udev-rules
    # Copy rules file
    sudo cp -v 51-android.rules /etc/udev/rules.d/51-android.rules
    # OR create a sym-link to the rules file - choose this option if you'd like to update your udev rules using git.
    sudo ln -sf "$PWD"/51-android.rules /etc/udev/rules.d/51-android.rules
    # Change file permissions
    sudo chmod a+r /etc/udev/rules.d/51-android.rules
    # If adbusers group already exists remove old adbusers group
    groupdel adbusers
    # add the adbusers group if it's doesn't already exist
    sudo mkdir -p /usr/lib/sysusers.d/ && sudo cp android-udev.conf /usr/lib/sysusers.d/
    sudo systemd-sysusers # (1)
    # OR on Fedora:
    groupadd adbusers
    # Add your user to the adbusers group
    sudo usermod -a -G adbusers $(whoami)
    # Restart UDEV
    sudo udevadm control --reload-rules
    sudo service udev restart
    # OR on Fedora:
    sudo systemctl restart systemd-udevd.service
    # Restart the ADB server
    adb kill-server
    # Replug your Android device and verify that USB debugging is enabled in developer options
    adb devices
    # You should now see your device
    

    The above steps are described on android-udev-rules. It worked for me.

    Just be sure to confirm the dialog that will appear on your phone screen after replug it.

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

    When you restart udev, kill adb server & start adb server goto android sdk installation path & do all on sudo. then run adb devices it will solve permission problem.

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

    If anyone faces the following error message when they use adb devices

    no permissions (verify udev rules); see [http://developer.android.com/tools/device.html]
    

    Execute the following

    sudo -s 
    adb kill-server
    adb start-server
    

    That fixed the issue for me on a custom build android device

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

    Nothing worked for me until I finally found the answer here: http://ptspts.blogspot.co.il/2011/10/how-to-fix-adb-no-permissions-error-on.html

    I'm copying the text here in case it disappears in the future.

    Create a file named /tmp/android.rules with the following contents (hex vendor numbers were taken from the vendor list page):

    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1bbb", MODE="0666"
    

    Run the following commands:

    sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules
    sudo chmod 644   /etc/udev/rules.d/51-android.rules
    sudo chown root. /etc/udev/rules.d/51-android.rules
    sudo service udev restart
    sudo killall adb
    

    Disconnect the USB cable between the phone and the computer.

    Reconnect the phone.

    Run adb devices to confirm that now it has permission to access the phone.

    Please note that it's possible to use , USER="$LOGINNAME" instead of , MODE="0666" in the .rules file, substituting $LOGINNAME for your login name, i.e. what id -nu prints.

    In some cases it can be necessary to give the udev rules file a name that sorts close to the end, such as z51-android.rules.

    0 讨论(0)
  • 2020-11-22 13:09
    sudo usermod -aG plugdev $LOGNAME
    

    This command worked for me

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

    Try instead of GROUP="plugdev" use the main group of your user.

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