I would like to get a notification when Gadle finish to build my app,
Please note that I'm not very familliar with Gradle except for the usual statements used in Android Studio but I'm glad I could learn something.
The best way I've seen so far seems to use announce
and build-announcements
plugins, as it is stated in this link. Unfortunately it is meant for Gradle in general and I cannot see how to adapt it to Android Studio's builds system. BTW, I'm on windows and have Snarl installed but no clue about how to make it work with Android Studio.
As in the tutorial, I applied both plugins to my app/build.gradle.
I first tried to adapt the code from this SO question. Since there was no real infromation about it, I wrote these lines at the root of the gradle file.
assembleRelease.doLast {
announce.local.send "Gradle Info Task", 'Running'
println gradle.gradleVersion
announce.announce("helloWorld completed!", "local")
}
However, Gradle won't even sync, throwing this error:
Could not get unknown property 'assembleRelease' for project ':myApplication' of type org.gradle.api.Project.
I then tried to create a task like seen in this other SO question:
task notification() {
announce.local.send "Gradle Info Task", 'Running'
println gradle.gradleVersion
announce.announce("helloWorld completed!", "local")
}
build.finalizedBy(notification) //
This doesn't throw any error but no notification is showing.
Why did my attempts failed ? How could I achieve my goal ?
If possible, information about how I should have searched to find this information myself is very welcome.