The Tall Matt
The Tall Matt

Reputation: 61

Android Gradle save log output to file

Using Android and Gradle how can I save the console messages of gradlew tasks to a file? For example when running 'gradlew connectedCheck -i' how do I save the run times and any failures to a file?

Upvotes: 6

Views: 5415

Answers (2)

jhyry-gcpud
jhyry-gcpud

Reputation: 165

In Powershell on Windows where tee is typically not available, you can do the same thing with the normal redirection operator (looks similar to BASH, but does indeed work):

./gradlew connectedCheck -i 2>&1 > file.txt

As far as I know this should work all the way back to Powershell 2.0, only because we still use it at work on some of our older servers. I can't find docs for anything older than v3.0, for which the documentation is here:

about_Redirection | Microsoft Docs

Upvotes: 0

sirvon
sirvon

Reputation: 2635

In bash/command line run:

 ./gradlew connectedCheck -i 2>&1 | tee file.txt

Upvotes: 10

Related Questions