Search code examples
androidshellcommand-lineadbandroid-uiautomator

Android UI testing: "adb shell uiautomator" throws error, "uiautomator" in "adb shell" works


I would like to compile and run Android UI black-box tests using only command-line tools on Windows. I wrote an UiAutomatorTestCase, built it, and uploaded it into /data/local/tmp/. I verified that the jar file was copied into the latter directory.

If I type

adb shell

and then type

uiautomator runtest MyTest.jar –c com.example.MyTest 

at the adb shell prompt, the test runs successfully. So far so good.

The problem is if I combine these two steps and type

adb shell uiautomator runtest MyTest.jar –c com.example.MyTest

then I get the following error:

Error: /data/local/tmp/ľc does not exist

According to the documentation, this should work. The error is the same on Windows 7 Pro 32-bit HUN and on Windows 8.1 Pro 64-bit ENG. The device is a Samsung Galaxy S3 Mini (GT-I8190), running Android 4.1.2 (API level 16).

What am I doing wrong?


Solution

  • I strongly suppose,

    adb shell $ <command> is same as adb shell <command>. I've never encountered any discrepancy in this regards.

    Please try adb kill-server and adb start-server

    Please also try adb -s <device_id> shell <command> you can find <device_id> from adb devices

    Can you also please let us know what is the output of adb version?