18

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

Jeremy HOFFMANN
  • 1,230
  • 1
  • 11
  • 21
  • What android SDK are u using?? – Woj Sep 10 '18 at 09:57
  • @Woj I use SDK 27 – Jeremy HOFFMANN Sep 10 '18 at 10:29
  • What about Xamarin.UITest? – Woj Sep 10 '18 at 10:46
  • Last version, 2.25.. for the nunit package, I did not touch it and I let the basic ones – Jeremy HOFFMANN Sep 10 '18 at 10:51
  • I noticed that I also had this: Severity Code Description Project File Line Suppression State Error NU1201 Project App4.Android is not compatible with net461 (.NETFramework,Version=v4.6.1) / win-x86. Project App4.Android supports: monoandroid81 (MonoAndroid,Version=v8.1) UITest1 C:\Users\Jerem\source\repos\App4\UITest1\UITest1.csproj 1 – Jeremy HOFFMANN Sep 10 '18 at 11:11
  • and this when i want run test : [10/09/2018 13:13:44 Informational] ========== Discover test finished: 1 found (0:00:03,240636) ========== [10/09/2018 13:15:47 Informational] ------ Run test started ------ [10/09/2018 13:15:48 Warning] L'exécuteur de tests ayant l'URI 'executor://nunittestexecutor/' est introuvable. Vérifiez que l'exécuteur de tests est installé et qu'il prend en charge le runtime .NET version . [10/09/2018 13:15:48 Informational] ========== Run test finished: 0 run (0:00:00,8840368) ========== – Jeremy HOFFMANN Sep 10 '18 at 11:16
  • I would *assume* you have multiple android sdks installed on your PC – SushiHangover Sep 10 '18 at 11:28
  • i don't know, where i can find this ? – Jeremy HOFFMANN Sep 10 '18 at 11:42
  • 2
    i find platform-tools.old****, i delete this – Jeremy HOFFMANN Sep 10 '18 at 11:56
  • I find the problem, I had several SDK, thank you very much! – Jeremy HOFFMANN Sep 10 '18 at 12:39

3 Answers3

26

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

Jeremy HOFFMANN
  • 1,230
  • 1
  • 11
  • 21
11

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.

Victor Chelaru
  • 4,491
  • 3
  • 35
  • 49
6

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.

Y Nakamura
  • 61
  • 1
  • 2