replaykit is a command line tool intended for mobile continuous integration, which provides the ability to:
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.
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).
adb to be present in
PATH. You can install the Android SDK and ensure
<sdk>/platform-tools is in your PATH.
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:
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
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:
If you want to replay to more than one devices, simply replace
serialno with a comma-separated serialno list like
With replaykit, you can mirror the touchscreen events from one device to other devices in real time.
replaykit devices mirror <from_device> <to_device>
<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:
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
Apache License v2