Search code examples
androidgroovyadb

Executing adb pull via Groovy results in corrupt file


I try to execute adb pull via a groovy file to download files automatically from the device.

private void getFile(String fileName) {
    def process = new ProcessBuilder().inheritIO()
                     .command(adbExec, "pull", "/sdcard/some.mp4").start();
    process.waitFor();
}

After the process is finished, unfortunately the file (mp4 from screenrecord) seems to be corrupt. If i "pull it manually" everything is fine. Any ideas?

Cheers


Solution

  • Solved: After cancelling the screenrecord (via script) it needs some time to save it correctly. Screenrecord -> finished -> sleep -> pull -> works