I've read I can simulate a tap on my touchscreen by using adb but it doesn't work:
C:\>adb shell input touchscreen tap 1 1
Error: Unknown command: touchscreen
usage: input [text|keyevent]
input text
input keyevent
How come I can't send a tap to my device? I have the latest version of the SDK tools and the SDK platform tools. Android Debug Bridge version 1.0.32
. Thanks
Answer
Your version of SDK tools has nothing to do with the parameters input
can understand or execute. Input is a binary in Android OS which can be run independently without requiring any set of external tools such as ADB.
The reason you receive the error "Error: Unknown command: touchscreen
" is because you're running an Android version earlier than Android 4.1.1. You would already notice that in the input
usage you posted, the binary entertains only two parameters i.e. text
and keyevent
.
In Android 4.0.x, the input
command's usage remains the same as the one you posted. In fact, even Android 2.3.7 has the same input command's usage. (See com.android.commands.input.Input on GrepCode for comparison of command's usage between Android versions.)
It was Android 4.1.1 which introduced tap
and swipe
parameter with usage,
usage: input ...
input text
input keyevent
input tap
input swipe
See the source code for more.
No comments:
Post a Comment