Android Studio recognizes physical Device as Null?

后端 未结 19 1611
攒了一身酷
攒了一身酷 2020-11-30 21:19

I\'ve been developing an Android Application for Android (SDK min version 14) and I have testing it normally with tablets such as Samsung Galaxy 2 and Nex

19条回答
  •  醉梦人生
    2020-11-30 21:46

    Have the same problem with my Nexus 5/5X/Pixel 2 XL on Ubuntu 18.04.

    A permanent solution is to add a udev rule so that you can always access the device.

    • Find your device with the command lsusb. This outputs e.g. for my Pixel 2 XL this:

      Bus 001 Device 003: ID 18d1:4ee7 Google Inc.
      
      # This means: BUS=001, DEVICE=003, VENDOR=18d1, PRODUCT=4ee7
      
    • Now check the permissions. Replace 001 and 003 with your parameters:

      ls -l /dev/bus/usb/001/008
      
      # Output: crw-rw-r-T 1 root root 189, 8 Nov 10 18:34 /dev/bus/usb/001/003
      # Unless you are root, you are missing the permissions to access the device
      
    • To fix this, create a udev rule file with sudo nano /etc/udev/rules.d/51-android.rules with the following content:

      SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee7", MODE="0660", 
      GROUP="plugdev", SYMLINK+="android%n"
      
      # You need to replace "18d1" and "4ee7" with your output of `lsusb` above
      
    • Unplug and plug you device back in. It should now always be recognized. If not, restart the adb server a last time with adb kill-server.

    Source: http://www.janosgyerik.com/adding-udev-rules-for-usb-debugging-android-devices/

提交回复
热议问题