简体   繁体   中英

how to do something before a task in Android gradle build?

well,when android studio build,there are many tasks list in the gradle console like the following:

...
:app:buildInfoDevDebugLoader
:extra:ViewPagerIndicator:preBuild UP-TO-DATE
:extra:ViewPagerIndicator:preReleaseBuild UP-TO-DATE
:extra:sweetalertdialoglibrary:preBuild
:extra:Android-PullToRefresh:preBuild UP-TO-DATE
:extra:sweetalertdialoglibrary:preBuild UP-TO-DATE
...

now i would like to do something(just like a task) before one of them(eg " :app:buildInfoDevDebugLoader "), so what code should i write in the build.gradle ?

thanks in advance.

If you want to add another Action to a task you can use doFirst() to prepend and doLast() to append to the list of Actions.

Eg buildInfoDevDebugLoader.doFirst { println "I am the first action" }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM