How to get a notification when Android Studio finish a build?
up vote
-1
down vote
favorite
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.
android android-studio gradle notifications android-gradle
add a comment |
up vote
-1
down vote
favorite
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.
android android-studio gradle notifications android-gradle
Anyone downvoting this question should at least explain why... How am I supposed to improve it if I don't know what is wrong ?
– Dan Chaltiel
yesterday
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
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.
android android-studio gradle notifications android-gradle
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.
android android-studio gradle notifications android-gradle
android android-studio gradle notifications android-gradle
edited Nov 10 at 19:32
asked Nov 10 at 12:27
Dan Chaltiel
1,53121838
1,53121838
Anyone downvoting this question should at least explain why... How am I supposed to improve it if I don't know what is wrong ?
– Dan Chaltiel
yesterday
add a comment |
Anyone downvoting this question should at least explain why... How am I supposed to improve it if I don't know what is wrong ?
– Dan Chaltiel
yesterday
Anyone downvoting this question should at least explain why... How am I supposed to improve it if I don't know what is wrong ?
– Dan Chaltiel
yesterday
Anyone downvoting this question should at least explain why... How am I supposed to improve it if I don't know what is wrong ?
– Dan Chaltiel
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
you need to add plugins announce and build announcements.
the following destinations are supported: Twitter, notify-send (Ubuntu), Snarl (Windows), Growl (macOS). those are the plugins required:
rootProject {
apply plugin: "announce"
apply plugin: 'build-announcements'
}
and to finalize the build process (see supported notification services):
// it finalizes :assemble
task finalizeBuild {
doLast {
println(":finalizeBuild > doLast")
announce.announce("task :assemble completed!", "snarl")
}
}
tasks.whenTaskAdded { task ->
if (task.name == "assembleDebug") {
task.finalizedBy finalizeBuild
} else if (task.name == "assembleRelease") {
task.finalizedBy finalizeBuild
}
}
Thank you for your answer but I already have added these 2 plugins, as stated in the question. I also know all these things as I obviously read all links I provided. I deited my question so my platform is known. If you want to help me, could you please provide som answers to my questions ? Or maybe some code ?
– Dan Chaltiel
Nov 10 at 19:32
@DanChaltiel if the project does not have anyassembleRelease
task, it might be lacking abuildType
with namerelease
. there also is no taskbuild
.assembleDebug
&assembleRelease
are the last tasks.
– Martin Zeitler
2 days ago
As I said, I only know basics about gradle and even never had to use it outside of AS, hence I am here for help. I think your answer, even after edits, is more thought for gradle-aware people so I'm afraid I'm still as lost as at start. I think I use the default config of Android Studio with bothdebug
andrelease
buildTypes and I don't even know where to look at to add a task without blasting everything out (and I couldn't find any simple tutorial). Your code doesn't work when I insert it at the bottom of app/build.gradle, was it the right place ? Could you elaborate a little (ELI5) ?
– Dan Chaltiel
yesterday
@DanChaltiel the names of the tasks may vary. just run./gradlew tasks
to get the correct names. or check the build log, what the task at the very bottom is. without build-types, it might beassemble
.
– Martin Zeitler
yesterday
Your code is finally working, but only theprintln
part. The command of your last comment returned all expected tasks includedassemble
,assembleDebug
&assembleRelease
. Still no clue why Gradle won't recognise them anyway. I think my very problem is that theannounce
plugin doesn't work and the Snarl doc is not much of help. Is there any config I should know about to connect Gradle to Snarl ? I couldn't find any doc about it...
– Dan Chaltiel
yesterday
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
you need to add plugins announce and build announcements.
the following destinations are supported: Twitter, notify-send (Ubuntu), Snarl (Windows), Growl (macOS). those are the plugins required:
rootProject {
apply plugin: "announce"
apply plugin: 'build-announcements'
}
and to finalize the build process (see supported notification services):
// it finalizes :assemble
task finalizeBuild {
doLast {
println(":finalizeBuild > doLast")
announce.announce("task :assemble completed!", "snarl")
}
}
tasks.whenTaskAdded { task ->
if (task.name == "assembleDebug") {
task.finalizedBy finalizeBuild
} else if (task.name == "assembleRelease") {
task.finalizedBy finalizeBuild
}
}
Thank you for your answer but I already have added these 2 plugins, as stated in the question. I also know all these things as I obviously read all links I provided. I deited my question so my platform is known. If you want to help me, could you please provide som answers to my questions ? Or maybe some code ?
– Dan Chaltiel
Nov 10 at 19:32
@DanChaltiel if the project does not have anyassembleRelease
task, it might be lacking abuildType
with namerelease
. there also is no taskbuild
.assembleDebug
&assembleRelease
are the last tasks.
– Martin Zeitler
2 days ago
As I said, I only know basics about gradle and even never had to use it outside of AS, hence I am here for help. I think your answer, even after edits, is more thought for gradle-aware people so I'm afraid I'm still as lost as at start. I think I use the default config of Android Studio with bothdebug
andrelease
buildTypes and I don't even know where to look at to add a task without blasting everything out (and I couldn't find any simple tutorial). Your code doesn't work when I insert it at the bottom of app/build.gradle, was it the right place ? Could you elaborate a little (ELI5) ?
– Dan Chaltiel
yesterday
@DanChaltiel the names of the tasks may vary. just run./gradlew tasks
to get the correct names. or check the build log, what the task at the very bottom is. without build-types, it might beassemble
.
– Martin Zeitler
yesterday
Your code is finally working, but only theprintln
part. The command of your last comment returned all expected tasks includedassemble
,assembleDebug
&assembleRelease
. Still no clue why Gradle won't recognise them anyway. I think my very problem is that theannounce
plugin doesn't work and the Snarl doc is not much of help. Is there any config I should know about to connect Gradle to Snarl ? I couldn't find any doc about it...
– Dan Chaltiel
yesterday
add a comment |
up vote
0
down vote
you need to add plugins announce and build announcements.
the following destinations are supported: Twitter, notify-send (Ubuntu), Snarl (Windows), Growl (macOS). those are the plugins required:
rootProject {
apply plugin: "announce"
apply plugin: 'build-announcements'
}
and to finalize the build process (see supported notification services):
// it finalizes :assemble
task finalizeBuild {
doLast {
println(":finalizeBuild > doLast")
announce.announce("task :assemble completed!", "snarl")
}
}
tasks.whenTaskAdded { task ->
if (task.name == "assembleDebug") {
task.finalizedBy finalizeBuild
} else if (task.name == "assembleRelease") {
task.finalizedBy finalizeBuild
}
}
Thank you for your answer but I already have added these 2 plugins, as stated in the question. I also know all these things as I obviously read all links I provided. I deited my question so my platform is known. If you want to help me, could you please provide som answers to my questions ? Or maybe some code ?
– Dan Chaltiel
Nov 10 at 19:32
@DanChaltiel if the project does not have anyassembleRelease
task, it might be lacking abuildType
with namerelease
. there also is no taskbuild
.assembleDebug
&assembleRelease
are the last tasks.
– Martin Zeitler
2 days ago
As I said, I only know basics about gradle and even never had to use it outside of AS, hence I am here for help. I think your answer, even after edits, is more thought for gradle-aware people so I'm afraid I'm still as lost as at start. I think I use the default config of Android Studio with bothdebug
andrelease
buildTypes and I don't even know where to look at to add a task without blasting everything out (and I couldn't find any simple tutorial). Your code doesn't work when I insert it at the bottom of app/build.gradle, was it the right place ? Could you elaborate a little (ELI5) ?
– Dan Chaltiel
yesterday
@DanChaltiel the names of the tasks may vary. just run./gradlew tasks
to get the correct names. or check the build log, what the task at the very bottom is. without build-types, it might beassemble
.
– Martin Zeitler
yesterday
Your code is finally working, but only theprintln
part. The command of your last comment returned all expected tasks includedassemble
,assembleDebug
&assembleRelease
. Still no clue why Gradle won't recognise them anyway. I think my very problem is that theannounce
plugin doesn't work and the Snarl doc is not much of help. Is there any config I should know about to connect Gradle to Snarl ? I couldn't find any doc about it...
– Dan Chaltiel
yesterday
add a comment |
up vote
0
down vote
up vote
0
down vote
you need to add plugins announce and build announcements.
the following destinations are supported: Twitter, notify-send (Ubuntu), Snarl (Windows), Growl (macOS). those are the plugins required:
rootProject {
apply plugin: "announce"
apply plugin: 'build-announcements'
}
and to finalize the build process (see supported notification services):
// it finalizes :assemble
task finalizeBuild {
doLast {
println(":finalizeBuild > doLast")
announce.announce("task :assemble completed!", "snarl")
}
}
tasks.whenTaskAdded { task ->
if (task.name == "assembleDebug") {
task.finalizedBy finalizeBuild
} else if (task.name == "assembleRelease") {
task.finalizedBy finalizeBuild
}
}
you need to add plugins announce and build announcements.
the following destinations are supported: Twitter, notify-send (Ubuntu), Snarl (Windows), Growl (macOS). those are the plugins required:
rootProject {
apply plugin: "announce"
apply plugin: 'build-announcements'
}
and to finalize the build process (see supported notification services):
// it finalizes :assemble
task finalizeBuild {
doLast {
println(":finalizeBuild > doLast")
announce.announce("task :assemble completed!", "snarl")
}
}
tasks.whenTaskAdded { task ->
if (task.name == "assembleDebug") {
task.finalizedBy finalizeBuild
} else if (task.name == "assembleRelease") {
task.finalizedBy finalizeBuild
}
}
edited yesterday
answered Nov 10 at 17:57
Martin Zeitler
11.1k33559
11.1k33559
Thank you for your answer but I already have added these 2 plugins, as stated in the question. I also know all these things as I obviously read all links I provided. I deited my question so my platform is known. If you want to help me, could you please provide som answers to my questions ? Or maybe some code ?
– Dan Chaltiel
Nov 10 at 19:32
@DanChaltiel if the project does not have anyassembleRelease
task, it might be lacking abuildType
with namerelease
. there also is no taskbuild
.assembleDebug
&assembleRelease
are the last tasks.
– Martin Zeitler
2 days ago
As I said, I only know basics about gradle and even never had to use it outside of AS, hence I am here for help. I think your answer, even after edits, is more thought for gradle-aware people so I'm afraid I'm still as lost as at start. I think I use the default config of Android Studio with bothdebug
andrelease
buildTypes and I don't even know where to look at to add a task without blasting everything out (and I couldn't find any simple tutorial). Your code doesn't work when I insert it at the bottom of app/build.gradle, was it the right place ? Could you elaborate a little (ELI5) ?
– Dan Chaltiel
yesterday
@DanChaltiel the names of the tasks may vary. just run./gradlew tasks
to get the correct names. or check the build log, what the task at the very bottom is. without build-types, it might beassemble
.
– Martin Zeitler
yesterday
Your code is finally working, but only theprintln
part. The command of your last comment returned all expected tasks includedassemble
,assembleDebug
&assembleRelease
. Still no clue why Gradle won't recognise them anyway. I think my very problem is that theannounce
plugin doesn't work and the Snarl doc is not much of help. Is there any config I should know about to connect Gradle to Snarl ? I couldn't find any doc about it...
– Dan Chaltiel
yesterday
add a comment |
Thank you for your answer but I already have added these 2 plugins, as stated in the question. I also know all these things as I obviously read all links I provided. I deited my question so my platform is known. If you want to help me, could you please provide som answers to my questions ? Or maybe some code ?
– Dan Chaltiel
Nov 10 at 19:32
@DanChaltiel if the project does not have anyassembleRelease
task, it might be lacking abuildType
with namerelease
. there also is no taskbuild
.assembleDebug
&assembleRelease
are the last tasks.
– Martin Zeitler
2 days ago
As I said, I only know basics about gradle and even never had to use it outside of AS, hence I am here for help. I think your answer, even after edits, is more thought for gradle-aware people so I'm afraid I'm still as lost as at start. I think I use the default config of Android Studio with bothdebug
andrelease
buildTypes and I don't even know where to look at to add a task without blasting everything out (and I couldn't find any simple tutorial). Your code doesn't work when I insert it at the bottom of app/build.gradle, was it the right place ? Could you elaborate a little (ELI5) ?
– Dan Chaltiel
yesterday
@DanChaltiel the names of the tasks may vary. just run./gradlew tasks
to get the correct names. or check the build log, what the task at the very bottom is. without build-types, it might beassemble
.
– Martin Zeitler
yesterday
Your code is finally working, but only theprintln
part. The command of your last comment returned all expected tasks includedassemble
,assembleDebug
&assembleRelease
. Still no clue why Gradle won't recognise them anyway. I think my very problem is that theannounce
plugin doesn't work and the Snarl doc is not much of help. Is there any config I should know about to connect Gradle to Snarl ? I couldn't find any doc about it...
– Dan Chaltiel
yesterday
Thank you for your answer but I already have added these 2 plugins, as stated in the question. I also know all these things as I obviously read all links I provided. I deited my question so my platform is known. If you want to help me, could you please provide som answers to my questions ? Or maybe some code ?
– Dan Chaltiel
Nov 10 at 19:32
Thank you for your answer but I already have added these 2 plugins, as stated in the question. I also know all these things as I obviously read all links I provided. I deited my question so my platform is known. If you want to help me, could you please provide som answers to my questions ? Or maybe some code ?
– Dan Chaltiel
Nov 10 at 19:32
@DanChaltiel if the project does not have any
assembleRelease
task, it might be lacking a buildType
with name release
. there also is no task build
. assembleDebug
& assembleRelease
are the last tasks.– Martin Zeitler
2 days ago
@DanChaltiel if the project does not have any
assembleRelease
task, it might be lacking a buildType
with name release
. there also is no task build
. assembleDebug
& assembleRelease
are the last tasks.– Martin Zeitler
2 days ago
As I said, I only know basics about gradle and even never had to use it outside of AS, hence I am here for help. I think your answer, even after edits, is more thought for gradle-aware people so I'm afraid I'm still as lost as at start. I think I use the default config of Android Studio with both
debug
and release
buildTypes and I don't even know where to look at to add a task without blasting everything out (and I couldn't find any simple tutorial). Your code doesn't work when I insert it at the bottom of app/build.gradle, was it the right place ? Could you elaborate a little (ELI5) ?– Dan Chaltiel
yesterday
As I said, I only know basics about gradle and even never had to use it outside of AS, hence I am here for help. I think your answer, even after edits, is more thought for gradle-aware people so I'm afraid I'm still as lost as at start. I think I use the default config of Android Studio with both
debug
and release
buildTypes and I don't even know where to look at to add a task without blasting everything out (and I couldn't find any simple tutorial). Your code doesn't work when I insert it at the bottom of app/build.gradle, was it the right place ? Could you elaborate a little (ELI5) ?– Dan Chaltiel
yesterday
@DanChaltiel the names of the tasks may vary. just run
./gradlew tasks
to get the correct names. or check the build log, what the task at the very bottom is. without build-types, it might be assemble
.– Martin Zeitler
yesterday
@DanChaltiel the names of the tasks may vary. just run
./gradlew tasks
to get the correct names. or check the build log, what the task at the very bottom is. without build-types, it might be assemble
.– Martin Zeitler
yesterday
Your code is finally working, but only the
println
part. The command of your last comment returned all expected tasks included assemble
, assembleDebug
& assembleRelease
. Still no clue why Gradle won't recognise them anyway. I think my very problem is that the announce
plugin doesn't work and the Snarl doc is not much of help. Is there any config I should know about to connect Gradle to Snarl ? I couldn't find any doc about it...– Dan Chaltiel
yesterday
Your code is finally working, but only the
println
part. The command of your last comment returned all expected tasks included assemble
, assembleDebug
& assembleRelease
. Still no clue why Gradle won't recognise them anyway. I think my very problem is that the announce
plugin doesn't work and the Snarl doc is not much of help. Is there any config I should know about to connect Gradle to Snarl ? I couldn't find any doc about it...– Dan Chaltiel
yesterday
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238948%2fhow-to-get-a-notification-when-android-studio-finish-a-build%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Anyone downvoting this question should at least explain why... How am I supposed to improve it if I don't know what is wrong ?
– Dan Chaltiel
yesterday