Reputation: 115
My environment is:
Android phone : HTC Desired Z
Android version: 2.3.3
when i use the web method:http://developer.android.com/tools/testing/testing_ui.html
run the UI Testing with the command "adb shell uiautomator runtest LaunchSettings.jar -c com.uia.example.my.LaunchSettings"
it show the error message "uiautomator: permission denied" .
Anyone friend that tell me to the reason of error???
thank!~
Upvotes: 2
Views: 5907
Reputation: 3286
Can you double-check a couple of things please?
adb shell grep ro.build.version.sdk= system/build.prop
the result should be similar to ro.build.version.sdk=17
Here is a StackOverflow article on getting the version of Android using adb shell Getting Android SDK version of a device from command lineadb shell uiautomator runtest LaunchSettings.jar -c com.uia.example.my.LaunchSettings
command?I tested with an AVD running 2.3.3 (API level 10) and ran the commands to build, deploy and then run the UI Automator tests from the Android example from http://developer.android.com/tools/testing/testing_ui.html The error message I get is different from the one you report: I get uiautomator: not found
rather than permission denied
.
As a suggestion, try to run uiautomatorviewer
from the command line when your device is connected (which you can check with the adb devices
command - your device's serial number should be listed). When I run uiautomatorviewer against the AVD with 2.3.3 when I try to get a screen snapshot it tells me explicitly "UI Automator requires a device with API Level 16"
So in summary, AFAIK you need uiautomator with a device running API level 16 or later. In practice, UI Automator seems to be problematic on API level 16 (Android 4.1) and works best with devices running 4.2.1 of Android (API level 17).
Upvotes: 2