Quick tip: Logging in Gradle build scripts

Did you know that it is really easy to log something in your Gradle build files? As the Gradle documentation explains, Gradle adds two log levels: QUIET is used for important information messages, whereas LIFECYCLE should be used to log progress information messages.

To see how it works, take a look at the following screenshot. It demonstrates how to log if Android's new experimental toolchain Jack and Jill is enabled. To enable it, just insert useJack = true.
A small note... You may be asking yourself why I used the unusual == true. It appears that this expression is more reliable if the variable useJack is not present at all.

No comments:

Post a Comment