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

3

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

Allin answered 10/9, 2018 at 9:34 Comment(10)
What android SDK are u using??Instead
@Instead I use SDK 27Allin
What about Xamarin.UITest?Instead
Last version, 2.25.. for the nunit package, I did not touch it and I let the basic onesAllin
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 1Allin
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) ==========Allin
I would assume you have multiple android sdks installed on your PCPhlogistic
i don't know, where i can find this ?Allin
i find platform-tools.old****, i delete thisAllin
I find the problem, I had several SDK, thank you very much!Allin
A
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

Allin answered 12/12, 2018 at 16:0 Comment(1)
I had to revert to the .old and remove the newer version.Hurwitz
V
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.

Victual answered 17/12, 2018 at 16:57 Comment(3)
The versions are actually 1.0.40 and 1.0.39 rather than 1.40 and 1.39.Newspaperwoman
Thanks, I fixed it.Victual
Wish Xamarin.UITools would tell us which one it ACTUALLY wantedStaple
T
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.

Transient answered 27/9, 2018 at 5:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.