title: Separate integration test task on gradle with android
body: <p>I want to run tests that have the 'integration' word in the path to be excluded with the default test run, but I want to run them all together in a separate task. Currently I have a basic test configuration:</p>
  
  <pre><code>sourceSets {
      androidTest.setRoot('src/test')
  
      integrationTest.setRoot('src/test')
  }
  
  ...
  
  androidTestCompile 'junit:junit:4.11'
  androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.1'
  androidTestCompile files('libs/android-junit-report-1.5.8.jar')
  androidTestCompile 'com.squareup:fest-android:1.0.8'
  androidTestCompile 'org.robolectric:robolectric:2.3'
  
  integrationTestCompile 'junit:junit:4.11'
  integrationTestCompile 'com.jayway.android.robotium:robotium-solo:5.1'
  integrationTestCompile files('libs/android-junit-report-1.5.8.jar')
  integrationTestCompile 'com.squareup:fest-android:1.0.8'
  integrationTestCompile 'org.robolectric:robolectric:2.3'
  
  ...
  
  androidTest {
      include '**/*Test.class'
      exclude '**/espresso/**/*.class'
      exclude '**/integration/**'
  }
  
  task integrationTest(type: Test) {
      include '**/integration/**'
  }
  </code></pre>
  
  <p>This causes an error while syncing gradle in AS:</p>
  
  <pre><code>Warning: project ':ProjectName': Unable to resolve all content root directories
  Details: java.lang.NullPointerException: null
  </code></pre>
  
  <p>but if I remove the integrationTest task it doesn't occur. Also with the task present I am able to run the 'integrationTest' task but this causes another error:</p>
  
  <pre><code>Error:Could not determine the dependencies of task ':ProjectName:integrationTest'.
  A base directory must be specified in the task or via a method argument!
  </code></pre>