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

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

    In my case on ubuntu 12.04 LTS, I had to change my HTC Incredible usb mode from charge to Media and then the device showed up under adb. Of course, debugging was already on in both cases.

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

    For those using debian, the guide for setting up a device under Ubuntu to create the file "/etc/udev/rules.d/51-android.rules" does not work. I followed instructions from here. Putting down the same here for reference.

    Edit this file as superuser

    sudo nano /lib/udev/rules.d/91-permissions.rules
    

    Find the text similar to this

    # usbfs-like devices 
    SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ MODE=”0664″
    

    Then change the mode to 0666 like below

    # usbfs-like devices 
    SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, \ MODE=”0666″
    

    This allows adb to work, however we still need to set up the device so it can be recognized. We need to create this file as superuser,

    sudo nano /lib/udev/rules.d/99-android.rules
    

    and enter

    SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, ATTRS{idVendor}==”0bb4″, MODE=”0666″
    

    the above line is for HTC, follow @grebulon's post for complete list.

    Save the file and then restart udev as super user

    sudo /etc/init.d/udev restart
    

    Connect the phone via USB and it should be detected when you compile and run a project.

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

    Without unplugging

    All the provided answers assume that you are able to unplug and reconnect the USB cable. In situations where this is not possible (e.g., when you are remote), you can do the following to essentially do what the suggested udev rules would do on re-plug:

    lsusb
    

    Find the device you care about, e.g.:

    Bus 003 Device 005: ID 18d1:4ee4 Google Inc. Nexus
    

    Take note of the bus number it is on and then execute, e.g. for bus 003:

    sudo chmod a+w /dev/bus/usb/003/*
    

    Clearly this may be more permissive than you want (there may be more devices attached than just this one), but you get the idea.

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

    Enter the following commands:

    adb kill-server
    sudo ./adb start-server
    adb devices

    This happens when you are not running adb server as root.

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

    I had the same problem, the solution is as fellow: (by the way, you don't have to root your device.)

    1. Type "su" to switch to super user.
    2. your-path/adb kill-server.
    3. your-path/adb start-server.
    4. If no error occurs, you can see the device list with "your-path/adb devices" in root account.
    5. Quit super user.
    6. Now you can perform "adb devices" in your account.

    Enjoy.

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

    I used su and it started working. When I use Jetbrains with regular user, I see this problem but after restarting Jetbrains in su mode, I can see my device without doing anything.

    I am using Ubuntu 13.04 and Jetbrains 12.1.4

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