Visual Studio doesn't let me debug on android

2020-05-20 08:52发布

I'm developing an android app with Xamarin and Visual Studio 2013. I have connected my android applet to the computer. Sansung Kies recognizes the device. Adb recognizes it also because when I type "adb devices" the device appears in the list. But when I debug the app Visual Studio doesn't let me choose my device, it only proposes to me to use the android virtual emulator. In my device the "USB debug" option is enabled. So what am I doing wrong?

8条回答
我欲成王,谁敢阻挡
2楼-- · 2020-05-20 09:35

EDIT

Just got a new machine and ran into the same problem.

Following these steps: http://visualgdb.com/KB/usbdebug-manual/ as suggested by Veverke in the comment below fixed the issue for me.


just had the same issue and fixed it with a combination of these two links. Obviously our issue isn't the exact same issue that's listed in the first link but that's why I had to use both to kind of synthesize a solution.

https://web.archive.org/web/20140410204811/http://krumelur.me/2014/01/30/xamarins-visual-studio-plugin-missing-android-devices-genymotion-and-parallels-desktop-dont-panic/

http://developer.android.com/tools/extras/oem-usb.html

Basically, in Visual Studio 2013 start the Android SDK Manager. Scroll all the way down to the 'Extras' folder, where you will find the 'Google USB Driver'. Mine was already installed, so I deleted the package, confirmed I wanted it deleted, then reinstalled it.

Then, I opened Windows Explorer and right clicked 'Computer', then clicked 'Manage' (need Admin priviledges). In the newly opened Computer Management window I clicked 'Device Manager' under Computer Management > System Tools in the hierarchy on the left.

In the main window, I expanded 'Other Devices' and saw the device I was looking for. I right-clicked it and chose 'Update Driver Software', then 'Browse my computer for driver software'.

Now you need to hit Browse... and find where you installed the packages.. for myself it was under C:\Users\zumberge\AppData\Local\Android\android-sdk\extras\google\usb_driver. Click next, the you need to choose to accept Google, Inc. as a trusted source. Then the process should be finished and you'll be good to go.

Don't know if you need to restart VS2013, but I did for good measure.

Hope this helps and it's not too late.

查看更多
Summer. ? 凉城
3楼-- · 2020-05-20 09:36

Restart of Visual Studio 2013 has resolved the issue for me.

Details:

  • Visual Studio was open while I was trying to make the device visible to the system.
  • After installing the device driver, I have restarted the "adb" and saw that the device is added to the list "adb devices".
  • However the name of the device at the Visual Studio was not changed, some numbers.
  • After restarting the Visual Studio, real name of the device is shown "NVIDIA Shield Android TV.."

Then I did not get this error anymore.

查看更多
虎瘦雄心在
4楼-- · 2020-05-20 09:41

Also make sure you have the correct configuration selected for your device. (eg. ARM for most smartphones)

If its set to one that your device doesn't support, then the device won't show up even if adb can see it. Simply switching the configuration solved the problem for me.

查看更多
仙女界的扛把子
5楼-- · 2020-05-20 09:43

In case you are using Samsung and have MyKnox installed, you cannot enable USB-Debugging until you uninstall MyKnox as stated in This Link

查看更多
该账号已被封号
6楼-- · 2020-05-20 09:44

I followed most of the steps mentioned, but still couldn't get it to work. Some things I did were:

  • download and install google driver from android sdk manager
  • locate the device in windows device manager and update driver (pointed to the google usb driver)
  • switch usb connection from mtp to ptp
  • restarted visual studio
  • restarted computer

Finally, what worked for me was googling the drivers for my particular android device (lg g4) and landing on this site . Once I installed the drivers I was immediately able to debug in visual studio using my device. it works whether the usb connection is mtp or ptp.

http://www.andromods.com

查看更多
祖国的老花朵
7楼-- · 2020-05-20 09:49

After enabling debug mode on my android device, I found I had to change the 'USB PC Connection' option. It was set to 'Charge Device'. When I switched it to 'Media Sync (MTP)' and reconnected to my PC it then showed up in Device Manager, but the drivers did not appear to be working with VS. I reinstalled the 'Google USB Driver' in SDK Manager. I removed my device in Device Manager and added it back using the Google USB Driver. When I disconnected/reconnected the device to my PC, Windows asked what I'd like to do with the device. I realized the first time it had asked me, I quickly clicked 'Do Nothing'. This time I noticed the first option was to run an exe on the device to install the driver. After the install completed I disconnected/reconnected the device and the device prompted me to allow my PC to debug. After selecting 'Allow', the device showed up in VS while VS was already open.

查看更多
登录 后发表回答