Xamarin.UITests Android Device Not Detected or Not Working

ebandersen

I can't run Xamarin.UITests on any Android simulator/emulator. Any suggestions? I get the following errors when I try:

Google Emulator:

SetUp: System.Exception: Unable to run on a physical device without activation. The full version is available for Xamarin Test Cloud customers, for more information contact [email protected] If you are already a Xamarin Test Cloud customer, you can provide your api in one of the following ways: * Adding it ConfigureApp using the ApiKey method * Setting the XTC_API_KEY environment variable * Adding the following attribute to your Properties/AssemblyInfo.cs file: [assembly: Xamarin.UITest.TestCloudApiKey(YOUR_API_KEY)] * Place an xtc_api-key file containing your api key in an upstream directory from the test assembly

Xamarin Android Player:

SetUp: System.Exception: No devices connected

GenyMotion:

SetUp : System.Exception : Failed to execute: /users/erikandersen/Library/Developer/Xamarin/android-sdk-macosx/platform-tools/adb devices - exit code: 1 cannot bind 'tcp:5037' ADB server didn't ACK * failed to start daemon * error: adb server is out of date. Killing…

After updated GenyMotion to 2.3.1, I now get the following error:

SetUp: System.Exception: App Installation failed with output: 12050 KB/s (11199602 bytes in 0.907s) pkg: /data/local/tmp/final-xxxxxx.apk Failure [INSTALL_FAILED_CPU_ABI_INCOMPATIBLE]

NUnit Code

    AndroidApp _app;
    public string PathToAPK { get; set; }

    [TestFixtureSetUp]
    public void BeforeAll ()
    {
        var path = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
        var info = new FileInfo(path);
        var directory = info.Directory.Parent.Parent.Parent.FullName;

        PathToAPK = Path.Combine(directory, "Android", "bin", "Debug", "Demo.Android.apk");
    }

    [SetUp]
    public void BeforeEach ()
    {
        _app = ConfigureApp.Android.ApkFile (PathToAPK).StartApp ();
    }

    [Test]
    public void TestInvalidEmail ()
    {
        _app.EnterText (c => c.Class ("UITextField"), "");
    }

TestInvalidEmail() is never called because NUnit fails on

_app = ConfigureApp.Android.ApkFile (PathToAPK).StartApp ();

Background:

I'm using Xamarin.UITests for an iOS/Android application I'm developing and we're having issues with the Android side of things. iOS works fine. I've written each test twice, once in C# and once in Ruby using calabash, in order to isolate the issue. Calabash works fine, but any C# NUnit Test Project fails to connect to any emulator I try launching.

What I've tried:

  1. Making sure an emulator is already running before I run the tests
  2. Making sure only 1 emulator is running
  3. Restarting the adb server
  4. Trying multiple types of emulators (i.e. Xamarin Android Player, Gennymotion, and the Google Emulator)
ebandersen

So, after several hours of working on this, this fixed it:

  1. Upgrade GennyMotion to 2.3.1
  2. Delete my old GenyMotion Simulator (Nexus 4) and create a new one
  3. Add support for all ABIs in my Android Build settings

Android Project > Options > Android Build > Advanced Tab > Supported ABIs > Check "armeabi, armeabi-v7a, x86" > OK

  1. Generate a new .apk file via the terminal (while inside the Android project directory)

/usr/bin/xbuild /t:Package /p:Configuration=Release .csproj

  1. Resigned the .apk via calabash-android

calabash-android resign ./bin/Release/.apk

  1. In Xamarin Studio, set my Startup Project as the my UITest project
  2. Launch GenyMotion simulator
  3. Ran the tests under the Debug configuration with only the GenyMotion simulator active

And it worked! I still can't run UI tests with the Google Emulator or the Xamarin Android Player. Funny thing is, I also can't debug my Android project using GenyMotion. It's only good for UITests. SO here's my current setup:

Xamarin Android Player - Normal debug

GenyMotion - UITests

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Xamarin.UITests Android设备未检测到或无法正常工作

来自分类Dev

Visual Studio Xamarin.UITest:“ System.Exception:找不到Android SDK。” 运行UITests

来自分类Dev

Xamarin.UITests Android设备未检测到或无法正常工作

来自分类Dev

是否可以运行Xamarin.UITests for Android以在Visual Studio for MAC上在MAC上运行?

来自分类Dev

Xamarin.forms 中的 UITests 发布失败

来自分类Dev

Xamarin Forms Android 上的 Device.StartTimer

来自分类Dev

CSS Media Queries not Working for Android Device

来自分类Dev

Xamarin.UITests-在真实设备上进行测试-iOS-应用权限弹出窗口问题

来自分类Dev

Can't start Android Virtual Device with Xamarin and Visual Studio Community 2015

来自分类Dev

Kali Linux wifi card detected but not working

来自分类Dev

Udate Device SDK Android

来自分类Dev

Xamarin.Android与Android

来自分类Dev

Android ID代替Device ID

来自分类Dev

Change device name in wifidirect on android

来自分类Dev

Xamarin表单的BackDoor(Android)

来自分类Dev

降级Xamarin.Android

来自分类Dev

Xamarin清除Android日志

来自分类Dev

Android / Xamarin代码混淆

来自分类Dev

Xamarin Android上的振动

来自分类Dev

Xamarin Android日历活动

来自分类Dev

Xamarin Android中的BindableViewPager

来自分类Dev

NAudio和Xamarin Android

来自分类Dev

Xamarin Android绑定

来自分类Dev

Xamarin Android MvvmCross入门

来自分类Dev

pushwoosh onMessageReceive xamarin android

来自分类Dev

Xamarin Android-GetApplication

来自分类Dev

Xamarin Android项目

来自分类Dev

Xamarin的Android ListView错误

来自分类Dev

响应超时Xamarin Android