Skip to content
Command line tools for recording, replaying and mirroring touchscreen events for Android
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
darwin change cli name from appetizer to replaykit Jun 14, 2018
linux 1.0.8, support Android to P, allow touchscreen dev file to be specifi… Jun 14, 2018
win32 fix bug for add-trace-description on win32 Jun 16, 2018
.gitignore bad gitignore settings Jan 21, 2017
.travis.yml add slack integration May 25, 2017
CREDITS.md add OSS licenses, reorg folders Jan 21, 2017
LICENSE
README.cn.md 1.0.8, support Android to P, allow touchscreen dev file to be specifi… Jun 14, 2018
README.md 1.0.8, support Android to P, allow touchscreen dev file to be specifi… Jun 14, 2018
appveyor.yml update appveyor tests Jun 16, 2018
nixtest.sh 1.0.8, support Android to P, allow touchscreen dev file to be specifi… Jun 14, 2018
test.trace 1.0.8, support Android to P, allow touchscreen dev file to be specifi… Jun 14, 2018

README.md

replaykit Build Status Windows Build

中文说明

replaykit is a command line tool intended for mobile continuous integration, which provides the ability to:

  • record touchscreen events from one device and replay to many (aspect ratios must be the same)
  • control multiple devices concurrently (e.g., run a shell command, install an app, etc.)
  • mirror the touchscreen events from one device to many in real time (aspect ratios must be the same)

replaykit can work on Windows 7+, MacOS Mavericks+ and Linux, available for Android API 9-27(9.0 aka. P), emulators, VMs (like Genymotion) and real devices. To integrate replaykit with existing CI infrastructure, consider the Python wrapper.

Please submit issues for bug reports, enhancements and feature requests. Pull requests for documentation improvement are welcomed too.

Installation

The executable file can be found in the darwin/ for MacOS, win32/ for Windows and linux/ for Ubuntu, Fedora and CentOS. You might want to add to PATH to use the tool globally. Linux and MacOS build are both 64-bit and Windows build is 32-bit (compatible with 64-bit as WOW). replaykit requires adb to be present in PATH. You can install the Android SDK and ensure <sdk>/platform-tools is in your PATH.

Control Multiple Devices

Suppose you have several devices attached to the development machine via USB and you want them to perform the same action.

First, make sure replaykit recognizes all of them devices:

./darwin/replaykit devices list

You should see a JSON output. Note the serialno field, which is the same as the adb devices output. A serialno uniquely identifies a connected device.

Next, you can try these:

DEVICE=serialno1,serialno2 # device serialnos, comma separated, no whitespace!
replaykit devices control $DEVICE uninstall com.helloworld # uninstall an app on those devices
replaykit devices control $DEVICE install hellworld.apk # install an app
replaykit devices control $DEVICE kill_all # kill all background apps
replaykit devices control $DEVICE launch_pkg com.helloworld # launch an app
replaykit devices control $DEVICE shell input keyevent KEYCODE_HOME # simulate the home button
replaykit devices control $DEVICE shell pm grant com.helloworld android.permission.SOME_PERMISSION  # grant a permission to an app 
replaykit devices control $DEVICE shell "input keyboard text 'Paste%stext%son%sAndroid%sDevice'"  # input text (pre Android 6)
replaykit devices control $DEVICE shell "input keyboard text 'Paste text on Android Device'"  # input text (Android 6+)
replaykit devices control $DEVICE shell screenrecord /sdcard/demo.mp4  # record screen into a video(Android 4.4+)

Basically everything you did with adb shell can now be replaced with replaykit devices control serialno1,serialno2 shell to perform that on multiple devices simultaneously.

And, just in case you need them:

Record and Replay touchscreen events

Replaykit can record touchscreen events from one device and replay back to many to automate stuff.

replaykit trace record --device serailno mytrace.trace

Now find the device and start touching. The touchsceen events will be captured and saved to mytrace.trace. If you are done, type in exit to stop. You are all set if seeing "Recorder stopped, trace saved to mytrace.trace". Try not to use Ctrl+C.

Check if the trace is good:

replaykit trace info mytrace.trace

Again, it shows a JSON about the recorded trace, showing the screen resolution, time length, how many fingers, etc. To modify the description of this trace, use replaykit trace describe mytrace.trace "the description to be added".

Next replay the trace back to see how it goes:

replaykit trace replay mytrace.trace serialno

You will see something like the video below:

Record and replay

If you want to replay to more than one devices, simply replace serialno with a comma-separated serialno list like serialno1, serialno2.

Mirror Touchscreen Events

With replaykit, you can mirror the touchscreen events from one device to other devices in real time.

replaykit devices mirror <from_device> <to_device>

The <from_device> is a single serialno while <to_device> can be a comma-separated list of device serialnos. Make sure all involving devices have the same aspect ratio. Otherwise the command will fail. For devices with the same aspect ratio, the touchscreen events will automatically scale to adapt to the screen resolution.

Here is a demo:

mirroring

ADB related

Finally, replaykit provides some commands to check the ADB environment.

replaykit adb start-server  # start the ADB server
replaykit adb kill-server  # kill the ADB server
replaykit adb detectadb  # this tells where the adb binary locates. If not found, tune your PATH
replaykit adb check-server  # check if the adb server is running properly now

License

Apache License v2

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.