title: Execute task after another. doFirst, doLast Groovy/Gradle
body: <p>I'm new in gradle. How can I run exec one task after another? I've got a problem that task test1 runs before android.applicationVariants.all, and property test is empty,how to change it?</p>
  
  <p>project A</p>
  
  <pre><code>String test = ''
  android {
  android.applicationVariants.all.doFirst { 
  test = 'vasya' 
      }
  task test1.doLast{
          println "$test"
  }   
  </code></pre>
  
  <p>But I've got the following output: </p>
  
  <pre><code>* Where:
  Build file '/home/build.gradle' line: 57
  * What went wrong:
  A problem occurred evaluating project ':ProjectA'.
  &gt; No signature of method: java.util.ArrayList.doFirst() is applicable for argument types: (build_6g09fl113rl613     iaq870b0hod0$_run_closure1_closure12_closure18) values: [build_6g09fl113rl613iaq870b0hod0$_run_closure1_closure12_closure18@5f81a4ab] 
  Possible solutions: first(), toList(), asList(), sort(), sort(groovy.lang.Closure), sort(boolean)       
  </code></pre>