UiAutomator died while responding to command, Android physical device, C# VS2013

Dear Appium community,

I’m about to implement a test automation framework using the Appium .net driver.
I followed all the steps listed at http://appium.io/slate/en/v1.3.4/?ruby#running-appium-on-windows

Information about my environment:

  • Windows 8.1, VS2013, Appium 1.3.4.1
  • I need to use Visual Studio, Eclipse is not an option for other reasons. Appium .net driver version 1.2.0.6 was installed via NuGeT.
  • The phone is a Samsung Galaxy Ace 3, running 4.2.2 (API level 17). USB drivers are installed, adb recognizes the phone and USB debugging is enabled.
  • I do not have access to the app’s source code, only the apk (it’s a third party app done for my company)
  • JDK 1.7.0.51, PATH set.
  • Android API 17 installed, SDK-Tools 24, Platform-tools 21, Build-tools 21.1.1, PATH values and ANDROID_HOME set.

I wanted to try out the FindElementsByAndroidUIAutomator method with the following class:

using System;
using Automation.Helpers;
using OpenQA.Selenium;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Remote;
using System.Collections.Generic;
using System.Threading;
using System.Drawing;

namespace Automation
{
    public static class TestClass2
    {
        public static AppiumDriver driver;
        public static DesiredCapabilities capabilities; 
        public static void run()
        {
            capabilities = Caps.androidGalaxyAce3Caps(Apps.get("2_android_uat"));

            try
            {
                driver = new AppiumDriver(new Uri("http://127.0.0.1:4723/wd/hub"), capabilities);
            }
            catch (Exception)
            {
                throw;
            }
            Thread.Sleep(5000);

            // http://developer.android.com/tools/help/uiautomator/UiSelector.html

            var asd = driver.FindElementsByAndroidUIAutomator("new UiSelector().clickable(true)");

            return;
        } 
    }
}

Capabilities:
appium-version is set to “1.3”
platformName is set to “Android”
platformVersion is set to “4.2.2”
the rest is configured according to the apk.

I put a breakpoint on return, and wanted to check out the contents of asd.

After the app is deployed and loaded on the phone, the execution halts with an exception:

UiAutomator died while responding to command, please check appium logs!

The appium server logs contain the following:

info: [debug] [UIAUTOMATOR STDOUT] Error in testRunServer:
info: [debug] [UIAUTOMATOR STDOUT] java.lang.NoClassDefFoundError: com.android.uiautomator.core.Configurator
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElement.(AndroidElement.java:26)
… trace continues but did not want this post to be superlong

I tried creating a global CLASSPATH variable, and setting it to a folder containing the extracted uiautomator.jar file so that it would find the class, but it didn’t really work out.

Any suggestions?

Thanks

I ran into the same problem. After upgraded to appium 1.3.4, I ran into the exact same exception:

info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.TextView[@long-clickable='true']","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.TextView[@long-clickable='true'] using XPATH with the contextId:  multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[CLASS=android.widget.TextView, INSTANCE=1]
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Error in testRunServer:
info: [debug] [UIAUTOMATOR STDOUT] java.lang.NoClassDefFoundError: com.android.uiautomator.core.Configurator
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElement.<init>(AndroidElement.java:26)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.addElement(AndroidElementsHash.java:47)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.getElement(AndroidElementsHash.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.fetchElement(Find.java:150)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.execute(Find.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidCommandExecutor.execute(AndroidCommandExecutor.java:64)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.runCommand(SocketServer.java:168)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.handleClientData(SocketServer.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.listenForever(SocketServer.java:133)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.Bootstrap.testRunServer(Bootstrap.java:16)
info: [debug] [UIAUTOMATOR STDOUT] at java.lang.reflect.Method.invokeNative(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:144)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:87)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
info: [debug] [UIAUTOMATOR STDOUT] at dalvik.system.NativeStart.main(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stack=java.lang.NoClassDefFoundError: com.android.uiautomator.core.Configurator
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElement.<init>(AndroidElement.java:26)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.addElement(AndroidElementsHash.java:47)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidElementsHash.getElement(AndroidElementsHash.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.fetchElement(Find.java:150)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.handler.Find.execute(Find.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.AndroidCommandExecutor.execute(AndroidCommandExecutor.java:64)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.runCommand(SocketServer.java:168)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.handleClientData(SocketServer.java:89)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.SocketServer.listenForever(SocketServer.java:133)
info: [debug] [UIAUTOMATOR STDOUT] at io.appium.android.bootstrap.Bootstrap.testRunServer(Bootstrap.java:16)
info: [debug] [UIAUTOMATOR STDOUT] at java.lang.reflect.Method.invokeNative(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.start(UiAutomatorTestRunner.java:144)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.uiautomator.testrunner.UiAutomatorTestRunner.run(UiAutomatorTestRunner.java:87)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.RunTestCommand.run(RunTestCommand.java:90)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.commands.uiautomator.Launcher.main(Launcher.java:83)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
info: [debug] [UIAUTOMATOR STDOUT] at dalvik.system.NativeStart.main(Native Method)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.E
info: [debug] [UIAUTOMATOR STDOUT] Time: 90.234
info: [debug] [UIAUTOMATOR STDOUT] FAILURES!!!

It looks like Appium switched to use com.android.uiautomator.core.Configurator which does not support till API Level 18 (http://developer.android.com/tools/help/uiautomator/Configurator.html).

Once I switched to use emulator that’s API level 18 or higher, I don’t see this problem anymore. However, API Level 17 was ok with appium 1.3.1.

Thank you for your reply. I switched to an LG G2 mini running 4.4.2, and everything is fine. The readme/setup guide should be updated! :slight_smile:

Does this mean that appium can’t be used for API level 18 or lower any more?

Also, is this only for C# client or also for all other clients including Java client? I got the same error using Java client and hence ended up on this page.

it’s actually a bug and I think they fixed it already. If you use the latest appium build from github (git clone https://github.com/appium/appium.git), the problem is fixed. And that’s what I am using.

Could you please provide a way to build appium from Git sources.
Thank you

Here’s the documentation to build appium from scratch. It works on mac but no sure on windows:

Still valid with 1.3.5-beta.
I can’t upgrade from 1.3.1 and can’t use latest fixes and features because of this issue.

What android version are you using? If you’re using < API 18, you need to configure Appium to use Selendroid.