0

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(e.g ":app:buildInfoDevDebugLoader"), so what code should i write in the build.gradle?

thanks in advance.

SDJSK
  • 1,292
  • 17
  • 24
  • 1
    can I know why do you want to do that? – Veeresh Charantimath Mar 11 '16 at 04:34
  • AndroidAnnotation(AA) framework always generate new classes(whether I modify code related to AA or not.) when i use the new feature **Instant Run** in android studio, so Instant Run regards that code changed(actually that code change nothing but File modification time) and each time i use Instant Run it takes so much time.(i test it if i copy all generated code to my source files and disable the AA, the Instant Run will be so fast) so now i want to write a task just after the AA task executes, which acts just like my manual way to improve the time of "Instant Run" – SDJSK Mar 11 '16 at 04:55
  • you want to reduce the time taken to build your project? – Veeresh Charantimath Mar 11 '16 at 04:57
  • yeah,actually i will do so, first i create and add a new source folder name "AAgen" to the project, and the code write in the build.gradle should help me to compare the AA generated code with the code in "AAgen", then only copy or replace the different file to the "AAgen" folder, at last delete all the AA generated code. – SDJSK Mar 11 '16 at 05:01
  • I think this is the way http://stackoverflow.com/a/16853376/4848308 – Gueorgui Obregon Mar 11 '16 at 05:04

1 Answers1

0

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.

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

tomasulo
  • 1,252
  • 8
  • 9