Introduction: 基于 Gradle 的 Android gif 录屏脚本,录屏并自动上传至电脑,给常写博客的你~
More: Author   ReportBugs   

More information of gradle-screen-record with rich pictures, please see this blog:

Supported OS

  • Mac osx


0. Working with gradle environment

Gradle is required.

1. Prepare tools (Skip this part if installed)

Make sure these tools installed,or else install them first:

  • adb: We use it to get screen-record files with .mp4 format.
  • ffmpeg: We use it to convert the format of these files, from .mp4 to .gif.

More infomation about Prepare tools

2. Apply gradle-screen-record (Just one line)

Apply gradle-screen-record in rootProject/build.gradle, don't forget to Sync Gradle !!!:

apply from: ""

3. Record Screen

excute gradle cmd

excute gradle cmd with three params:

  • PfileName: [Required] Name of output gif(without postfix).
  • Psize: [Optional] Size of output gif.
  • Ptime: [Optional] Time of output gif.

For example:

./gradlew screenRecord -PfileName=test


./gradlew screenRecord -PfileName=test -Psize=1080x1920 -Ptime=5

operate your modile phone

When you see "> Building 50% > :screenRecord" in the terminal, the screen recording is begining. Just operate your modile phone as you want, and it will stop after "-Ptime" second.

4. Complete !!!

You will find the generated gif file in rootProject/screen-record/test.gif !!!

By the way, add it to git~

git add screen-record/.


support for windows.

Make issues or pull request, if you have good ideas ~


Helper to upload Gradle Android Artifacts to Maven repositories

深入理解 Android 之 Gradle

Support Me
About Me
Google+: Trinea trinea
GitHub: Trinea