I want to use a Xamarin.UITest project to test my application (and then upload the test to the App Center).
I am writing code in Visual Studio Community 2019 version 16.9.4 and want to build against the latest Android version.
When I try to run the tests locally I get the error:
System.Exception : Mono Shared Runtime is not supported. This can be resolved by changing the project configuration or using a Release build.
With regards to project configuration:
- I get this whether pointing to Android target framework version 11 (latest) or 10.
- In the project properties of my Android project (Android Options -> Packaging Properties) as per this screenshot the obvious solution to uncheck the 'Use Shared Runtime' option is not available.
- Manually adding the property
AndroidUseSharedRuntimeto the.csprojdoesn't seem to make a difference.
With regards to a Release build:
I have tried running against the
.apkbuilt in Release mode on target framework version 10, and it works! But I want to use version 11...When I have a target framework version of 11, I get this error on the test:
Failed to execute: C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe -s emulator-5554 install -g "C:\Users{name}\AppData\Local\Temp\uitest\a-2351CD300830FF81600819C12D0457454DDA69A2\final-9EB410B8BE4AE99B420FA491930368F065D971A1.apk" - exit code: 1
adb: failed to install C:\Users{name}\AppData\Local\Temp\uitest\a-2351CD300830FF81600819C12D0457454DDA69A2\final-9EB410B8BE4AE99B420FA491930368F065D971A1.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Scanning Failed.: No signature found in package of version 2 or newer for package {com.package.name}] Performing Streamed Install
I've seen a couple of posts about this message (leads here), and Android 11+ needs to be signed differently but I expected (hope) VS would do it automatically as part of its signing with that target version.
So, I have 2 questions - maybe it's an either/or:
- Am I missing something in the project configuration that means I don't need to do a separate Release build locally to create the
.apkbefore running my tests? - How can I get Xamarin.UITest to sign the app with the signature required for target framework version 11?