Android Studio recognizes physical Device as Null?

2019-01-10 07:32发布

问题:

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 Nexus 7. However when I tried to run the application (by clicking run in AndroidStudio), AS does not recognise the tablet information, which is shown in the picture below.

The interesting thing is that as shown in the picture above, AS is also detecting the device sdk as API 1 when it's Android version is 4.2.2 The tablet is already set to accept "USB debugging" in the developer options, I'have tried rebooting the tablet, and restarting AS, but still I get the same problem(everything is fine with nexus 7 and Samsung Galaxy 2).

The tablet/device I'm working on is a "VeryKool" T742

Environment information:
 OS: ubuntu
 AndroidStudio version: 0.8.6

 Tablet Android version:4.2.2
 Tablet Kernel version: 3.4.5
 App min SDK: 14

回答1:

Ok So I finally found the problem, apparently on this device you have to set to connect as camera(even after usb debugging is already enabled)

Also this link describes the setting up process



回答2:

I've seen this error a few times when adb hasn't been connected with correct permissions.

On the terminal try
~/Android/Sdk/platform-tools> ./adb devices

if it returns
<deviceIdentifier> no permissions

then you need to restart adb with correct perms
~/Android/Sdk/platform-tools$> ./adb kill-server ~/Android/Sdk/platform-tools$> sudo ./adb devices

if that worked then you'll get
List of devices attached * daemon not running. starting it now on port 5037 * * daemon started successfully * <deviceIdentifier> device

No more Sdk version resolution issues in Android Studio after that.



回答3:

Just run this command after you connect your device to your Ubuntu system:

adb devices

This works for me.

Note: Make sure you have selected file transfer option in your phone.



回答4:

On Ubuntu, with my Pixel XL on 8.0, I had to do this while plugged into computer:

Settings -> Connected Devices -> USB --> Change to 'Transferring Files'



回答5:

Ran into the same problem while using Android Studio on Ubuntu. Apparently for me the fix was to set the USB connection mode for the device as MTP.



回答6:

First check adb version:If it gives Output like

Android Debug Bridge version 1.0.32

Then just restart the daemon.

sudo adb kill-server
sudo adb start-server

else install adb first and restart the daemon Worked for me, in ubuntu 16.04.3



回答7:

Had the same problem with my Nexus 5X. My first solution was the adb kill-server solution mentioned here.

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

  • Find your device with the command lsusb, output e.g.:

    Bus 001 Device 008: ID 18d1:d002 Google Inc.
    
  • Check the permissions of the device, e.g. Bus 001, Device 008:

    ls -l /dev/bus/usb/001/008
    crw-rw-r-T 1 root root 189, 8 Nov 10 18:34 /dev/bus/usb/001/008
    # Unless you are root, you are missing the permissions to access the device
    
  • Create a udev rule file /etc/udev/rules.d/51-android.rules with the following content but replace idVendor and idProduct with your output of lsusb:

    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d002", MODE="0660", 
    GROUP="plugdev", SYMLINK+="android%n"
    
  • Unplug and plug you device back in. It should now always be recognized. If not, restart the adb server a last time.

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



回答8:

Disabling and re-enabling debugging while the device was connected did the trick for me.



回答9:

I had the same problem.

I solved it by opening my Android device Settings, then selecting "Turn off" then "Turn on" for USB Debugging.



回答10:

Sometimes in Linux (Centos 6 in my case) the reason can be that you didn't started Android Studio as the root user. please restart android studio as the root user and try it!



回答11:

For ubuntu machine select the transfer option and device will detected in android studio as well as for debugging. Generally device is at charging state for windows but for ubuntu this is how it works.

Also many a times device is not detected , do the same thing again.



回答12:

Needed MTP mode, but it does not come up under the USB side. In the storage setting on the menu bar item you get to set the PC connection type as ... MTP.



回答13:

check processes running, i had several adb processes running and i think this was screwing things up for me. Kill them all then restart Studio. HTC Sync Manager, GenyMotion etc and possibly when you have multiple Android Studio windows open can result in multiple conflicting adb processes.