UiAutomator quit before it successfully launched

Hi
I can’t run test with appium and android

Where:

  • Ubuntu 14.04 32-bit
  • Appium 1.4.16
  • Genymotion (Android 4.3, 5.0) & Real device (Android 5.1.1)
  • Robot framework

When I run test, I get:

WebDriverException: Message: A new session could not be
created. (Original error: UiAutomator quit before it successfully
launched)

In appium logs:

info: [debug] spawning:
/home/vitalii/android-sdk-linux/platform-tools/adb -s
192.168.57.101:5555 shell uiautomator runtest AppiumBootstrap.jar -c
io.appium.android.bootstrap.Bootstrap -e pkg com.test.app -e
disableAndroidWatchers false
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT: shortMsg=java.lang.IllegalStateException
info:
[debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_RESULT:
longMsg=UiAutomationService
android.accessibilityservice.IAccessibilityServiceClient$Stub$Proxy@25af113ealready
registered!
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_CODE: 0
info: [debug] UiAutomator exited

error: UiAutomator quit before it successfully launched
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: UiAutomator quit before it successfully launched

From the google by same error, I found that problem is in runned uiautomator. In appium logs I see, that there is killing of uiautomator:

info: Starting App
info: [debug] Attempting to kill all ‘uiautomator’ processes
info: [debug] Getting all processes with ‘uiautomator’
info: [debug] executing cmd: /home/vitalii/android-sdk-linux/platform-tools/adb -s 192.168.57.101:5555 shell “ps ‘uiautomator’”
info: [debug] No matching processes found

But if I run in console:

adb -s 192.168.57.101:5555 shell “ps ‘uiautomator’”

nothing will be found. And if search as:

adb -s 192.168.57.101:5555 shell “ps | grep ‘uiautomator’”

found:

u0_a60 1658 196 1010928 43344 ffffffff f76ebf75 S com.github.uiautomator

If I made adb kill for this process and run command, that fails in appium:

info: [debug] spawning:
/home/vitalii/android-sdk-linux/platform-tools/adb -s
192.168.57.101:5555 shell uiautomator runtest AppiumBootstrap.jar -c
io.appium.android.bootstrap.Bootstrap -e pkg com.test.app -e
disableAndroidWatchers false

I see no errors!
But I run test and it fails again. That’s mean test starts uiautomator again and doesn’t kill it.

Found that function of searching PID probably was changed after this comment

I have this problem with Genymotion emulator and real device.

Please help with any suggestions what to do.

Got exactly the same problem here…

Did you manage to resolve this issue?