Wednesday, 21 August 2013

Gradle adb Android Exec Task Hangs on Failure

Gradle adb Android Exec Task Hangs on Failure

I am trying to write a Gradle task that executes an adb command to clear
the app/data cache for a connected android device:
task clearAppDataCache(type: Exec) {
description = "Clears device app data/cache."
group = "Utils"
commandLine "$sdkDir/platform-tools/adb"
args = ["shell", "pm", "clear", "com.my.package"]
}
The above task works if the com.my.package android package is installed on
the device. However, if the package is not installed the task prints out a
failure and then hangs in the following manner:

Does anyone know why this might be the case? I would expect it to instead
failure and finish in a manner similar to how the raw shell command runs.

No comments:

Post a Comment