I try to Execute some simple UI tests on Xamarin Android.
AppInitializer:
public static IApp StartApp(Platform platform)
{
if (platform == Platform.Android)
{
return ConfigureApp
.Android
.ApkFile(@"D:\DEMO UI\DemoApp\DemoApp\DemoApp.Android\bin\Release\com.companyname.DemoApp.apk")
.StartApp();
}
return ConfigureApp
.iOS
.StartApp();
}
Tests
IApp app;
Platform platform;
public Tests(Platform platform)
{
this.platform = platform;
}
[SetUp]
public void BeforeEachTest()
{
app = AppInitializer.StartApp(platform);
}
[Test]
public void ButtonClick()
{
app.Tap("Mybutt");
var labelresult = app.Query("Mylabel").First(result => result.Text == "New text");
Assert.IsTrue(labelresult != null, "correct UI result");
}
But when I click Run selected text then got a message :
Message: SetUp : System.Exception : 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-35C99D3B2B84FFBF5EA16C49D8C264A148107FF6\final-BD39EFD80A0C98583FA77A85C7E24A8C14BDF412.apk" - exit code: 1 Failed to install C:\Users\Name\AppData\Local\Temp\uitest\a-35C99D3B2B84FFBF5EA16C49D8C264A148107FF6\final-BD39EFD80A0C98583FA77A85C7E24A8C14BDF412.apk: Failure [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113]
I think i was find the solution:
1) First one - You must use the Release not Debug.
2) Go to the Properties of you Project in Solution - alt+Enter(in my case it was DemoApp.Android).
2.1) take off the Use Shared runtime
2.2) in Linker Properties set Sdk assembly only
2.3) Advanced -> Supported architectures : select x86_x64; x86; armeabi-v7a;
3) Then rebuild solution and you *.apk file.
4) start android emulator
5) start you UI test
Hope this help someone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With