I have to write couple tests on Xamarin UI Test framework to check apk on emulator. I tried to install my apk in two ways:
1 adb.exe install path\com.company.mobiledemo.apk
2 through Xamarin UI Test
if (platform == Platform.Android)
{
AndroidApp app = ConfigureApp.Android
.ApkFile("path\\com.company.mobiledemo.apk")
.Debug()
.EnableLocalScreenshots()
.DeviceSerial("emulator-5554")
.StartApp();
return app;
}
In first approach apk installed and working correctly. But when apk installed via code above apk will be install but wont launch, just stopped after splash screen.
I have no idea why because both use the same apk file.
NUnit: 3.13.3
NUnit3TestAdapter: 4.2.1
Xamarin.UITest: 2.2.6
Emulator OS: Android 6.0 Api 23

Ok I found the solution. It's a bit confused and maybe there is a more easy fix. Problem as I understood is your apk and Instrumentation backend apk must be signed the same cert.
My steps:
I installed apk via adb command :
>adb.exe install ~\..\com.company.mobiledemo.apkThen changed
AppInitializer.cslike this :Then tried to launch test and got error :
It's ok.
You will see something like this :
Copy command from error message above, go to
C:\Program Files\Android\jdk\microsoft_dist_openjdk_1.8.0.25\binor directory where locatedjarsigner.exeExecute command after
System.Exception : Failed to execute:SignedTestServer.apkand copy it into folder containesdummy.apkFinalTestServer.apkappearedPS Close folder
C:\Users\{user}\AppData\Local\Temp\uitestbefore 9.