title: Gradle Clean Build and connectedAndroidTest
body: <p>I'm playing with Gradle for Android recently... It's powerful but painful at the same time.</p>
  
  <p>Initially, I followed Roboletric sample project, trying to make a gradle-based Android project with Robolectric testing support. After a while, I realise Robolectric doesn't even support API 19. Thus, I remove it from my build.gradle and try to use Junit and Instrumentation tests.</p>
  
  <p>I'm not familiar with either Android or Gradle or Roboletric. I only know that before I removed Robolectirc, whenever I made a build <code>./gradlew clean build</code> I was able to run all the tests. But now, I have to call <code>./gradlew connectedAndroidTest</code> in addition to run tests while the <code>build</code> command only calls <code>check</code> but no test is run and thus always show SUCCESSFUL</p>
  
  <p>I have attached my configuration here:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenCentral()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:0.10.+'
      }
  }
  apply plugin: 'android'
  
  repositories {
      mavenCentral()
  }
  
  android {
      compileSdkVersion 19
      buildToolsVersion '19.1.0'
  
      defaultConfig {
          minSdkVersion 9
          targetSdkVersion 19
          versionCode 1
          versionName "1.0"
          packageName "com.example"
          testPackageName "com.example.tests"
      }
  
      buildTypes {
          release {
              runProguard false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
          }
      }
  
      productFlavors {
          flavorDimensions "AppPackage", "AppEnvironment"
  
          appBasic {
              flavorDimension "AppPackage"
          }
  
          staging {
              flavorDimension "AppEnvironment"
          }
          production {
              flavorDimension "AppEnvironment"
          }
      }
  
      sourceSets {
          androidTest.setRoot('src/test')
          androidTestStaging.setRoot('src/testStaging')
          androidTestProduction.setRoot('src/testProduction')
      }
  
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:support-v4:20.0.0'
      compile 'com.android.support:appcompat-v7:20.0.0'
  }
  </code></pre>