Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot debug Xamarin Android application in VS with ADB

I am trying to run the sample TipCalc Xamarin (Android) application in Visual Studio, however after it compiles and I run the Android emulator, I'm told the:

adb server version (32) doesn't match this client (36)

How do I fix this? I've updated Xamarin and the Android SDK files and Xamarin is correctly pointing to my android SDK location (D:\dev\Xamarin\AndroidSDK).

enter image description here

Here's a screenshot of my Android SDK manager:

enter image description here

Here's a bigger snippet of the output:

1>D:\dev\Xamarin\AndroidSDK\platform-tools\adb.exe -s 169.254.138.177:5555 devices 
1>error: could not install *smartsocket* listener: cannot bind to 127.0.0.1:5037: Only one usage of each socket address (protocol/network address/port) is normally permitted. (10048)
1>List of devices attached
1>adb server version (32) doesn't match this client (36); killing...
1>could not read ok from ADB Server
1>* failed to start daemon *
1>error: cannot connect to daemon
1>
1>Selected device is not running.
1>Build FAILED.

Update: installing Android SDK Build-tools 24.0.3 (and removing 23.0.2) didn't help.


This answers provided at this this question don't help, as I don't know what Appium or Genymotion are, nor do I work with PHP. I agree though they are both caused by the android debugger, but I need the Xamarin fix.

like image 456
PeterX Avatar asked Oct 10 '16 00:10

PeterX


People also ask

Can I use Xamarin with VS code?

NET MAUI -- basically Xamarin. Forms supporting desktop apps -- can be used with Visual Studio Code, the super-popular, open source-based, cross-platform code editor.

Is Xamarin deprecated Android?

In May 2020, Microsoft announced that Xamarin. Forms, a major component of its mobile app development framework, would be deprecated in November 2021 in favour of a new .

How do you generate an .apk file from Xamarin forms project using Visual Studio?

To create the APK file, right-click the Xamarin. Android project in the Solution Explorer and select Archive... This will open the Archive manager and begin archiving the project, preparing to create the APK file.


1 Answers

The issue is you have another adb server running at the same time. When you install the Android SDK it installs a version of adb that Xamarin will use (in this case version 36), but some other tools also have adb installed with them. Some examples include Gennymotion and Appium as already mentioned, in my case it came as part of Mobizen which I was using for sharing the android device screen back to my Mac. You will have something installed which runs adb (version 32) causing the conflict.

What you'll need to do is locate the offending adb install and delete it. I'm assuming you are on windows so best to fire up task manager and have a look at the processes to find adb. Once you locate it you should be able to see what app it was installed from it's properties with based on it's path, so that you can uninstall it or delete it.

adb.exe process adb properties showing full path

like image 106
JimBobBennett Avatar answered Sep 30 '22 03:09

JimBobBennett