Cannot run XAMARIN UI TEST on xamarin.forms, error System.Exception

Viewed 4425

I want ton run Xamarin UI test, but when i run the test i have this error :

System.Exception : 'The running adb server is incompatible with the Android SDK version in use by UITest: 
C:\Program Files (x86)\Android\android-sdk

my start command-line : return ConfigureApp.Android.ApkFile("/Users/Jerem/source/repos/App4/App4/App4.Android/bin/Debug/com.companyname.App4-Signed.apk").StartApp();

Thanks for our helping

3 Answers

If you have the same error, check in our sdk directory if you have platform-tools and platform-tools.oldxxxx, delete old ! Just work after

Y Nakamura's answer moved me in the right direction but it still took me a long time to solve because I wasn't sure exactly what I was trying to solve. I'm going to expand on the answer here in case others run into the same problems that I did.

As mentioned, the problem seems to be caused by the files (not sure if it's adb.exe or other files) inside of platform-tools not being supported by Xamarin.UITest. platform-tools can be found in C:\Program Files (x86)\Android\android-sdk

I had platform-tools folder, plus two additional folders with old12341234 suffixes (the numbers didn't make any sense to me).

To figure out which version of adb.exe is in each folder:

  1. Open one of the folders
  2. Hold shift and right-click in the windows explorer window to see the Open PowerShell window here option
  3. In PowerShell, run the command ./adb.exe version to see the version number you are running Powershell adb version

In my case, the version that was too new was 1.0.40. I found a folder that had 1.0.39. I renamed the platform-tools folder that was too new to platform-toolsTooNew. I then renamed the folder that contained adb.exe v 1.0.39 to platform-tools, then restarted Visual Studio.

After doing all of that, my automated tests once-again worked!

Update November 2020

I was able to run with a newer version of ADB, but I had to delete the old folder from my android-sdk folder. I am using:

  • ADB version 1.0.41
  • Visual Studio 16.6.5
  • Xamarin 16.6.000.1064
  • Xamarin.Android SDK 10.3.1.4

I'll keep my original post above in case it helps others.

Android SDK Platform-Tools 28.0.0 (40) is too new. Try restoring 27.0.1 (39). Open folder %ANDROID_HOME%. If the folders platform-tools and platform-tools.oldxxxx appears, rename them to restore old version.

Related