'How to fix Mono Shared Runtime is not supported when running UI Test

This is a very frustrating issue and I have found lots of unhelpful articles, especially since they all point to Visual Studio 2019.

I get this issue when trying to run a Xamarin.UITest project.

System.Exception : Mono Shared Runtime is not supported. This can be resolved by changing the project configuration or using a Release build.

CSPROJ FILE

  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Test|AnyCPU'">
    <DebugSymbols>false</DebugSymbols>
    <DebugType>portable</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Test</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
    <AotAssemblies>false</AotAssemblies>
    <EnableLLVM>false</EnableLLVM>
    <AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
    <BundleAssemblies>false</BundleAssemblies>
    <EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
    <AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
  </PropertyGroup>

Properties

Properties



Solution 1:[1]

OP (Original Poster aka question-asker) seems to be doing everything right, in specifying the apk.

It appears that a SharedMonoFramework was still on the device, associated with the project's bundle id, from an earlier debug test run.

The app needed to be completely removed from the device.

One of these approaches:

  • Manually delete app from device.

  • Command prompt adb uninstall com.yourcompany.yourapp (the bundle id).

  • Factory reset the device.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ToolmakerSteve