title: Why does Gradle connectedDebugAndroidTest depend on validateSigningRelease?
body: <p>I'm setting up a Circle CI build server to run an Android app's instrumented tests and on running the connectedDebugAndroidTest Gradle task, it produces this failure:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  * What went wrong:
  Execution failed for task ':app:validateSigningRelease'.
  &gt; Keystore file not set for signing config release
  </code></pre>
  
  <p>It looks like it is a bit tricky to get release signing working on CircleCI (without putting the keystore in source control, yuk) so for now the release config is blank in my module's build file:</p>
  
  <pre><code>signingConfigs {
      release {
      }
  }
  </code></pre>
  
  <p>If I run connectedDebugAndroidTest on my local machine it also fails, BUT not if I run assembleDebug immediately before. i.e. running assembleDebug followed by connectedDebugAndroidTest works fine locally.</p>
  
  <p>I've tried providing dummy release signing details in the signing config, but the task is evaluating them (for use?) and so they are rejected.</p>
  
  <p>Why does connectedDebugAndroidTest depend on release signing at all if it is to run instrumented tests on the device using the debug build?</p>
  
  <p>Am I missing something, or is my only option to fully configure release signing on the CI server (with the keystore coming via a Dropbox share link, yuk) so it can run instrumented tests with a release APK?</p>
  
  <p>app/build.gradle:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  def versionMajor = 0
  def versionMinor = 18
  def versionPatch = 0
  def versionBuild = 0 // bump for dogfood builds, public betas, etc.
  
  android {
      compileSdkVersion 25
      buildToolsVersion "25.0.2"
      defaultConfig {
          applicationId "com.myapp.android"
          minSdkVersion 14
          targetSdkVersion 25
          versionCode versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
          versionName "${versionMajor}.${versionMinor}.${versionPatch}"
          archivesBaseName = "MyApp v$versionName"  // Names APK e.g. MyApp-v1.2.3-release.apk
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
  
      signingConfigs {
          release {
              storeFile rootProject.file("my-app-keystore.jks")
              if (storeFile.exists()) {
                  def config = new Properties()
                  config.load(new FileInputStream(rootProject.file("my-app-keystore.passwords")))
                  storePassword config.KeystorePassword
                  keyAlias config.KeyAlias
                  keyPassword config.KeyPassword
              }
          }
      }
  
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
              signingConfig signingConfigs.release
              testCoverageEnabled = true // Instrumentation only
          }
          debug {
              applicationIdSuffix ".debug" // App ID for debug builds has .debug suffix
              testCoverageEnabled = true // Instrumentation only
          }
      }
  
      dataBinding {
          enabled = true
      }
  
      lintOptions {
          disable 'ContentDescription', 'RtlHardcoded'
      }
  
      compileOptions {
          sourceCompatibility JavaVersion.VERSION_1_8
          targetCompatibility JavaVersion.VERSION_1_8
      }
  
      // Copy release APK to project root
      task copyReleaseApk(type: Copy) {
          from 'build/outputs/apk'
          into '..'
          include '**/*release.apk'
      }
  
      afterEvaluate {
          if (tasks.findByPath("packageRelease") == null) {tasks.create("packageRelease")}
          tasks.findByPath("packageRelease").finalizedBy(copyReleaseApk)
      }
  
  }
  
  ext {
      // Single place to specify the support library version
      supportLibraryVersion = '25.3.1'
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
          exclude group: 'com.google.code.findbugs'
          exclude module: 'espresso-idling-resource'
  //        exclude group: "javax.inject"
      })
      compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
  
      // Dagger dependency injection
      compile 'com.google.dagger:dagger:2.10'
      annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
      compile 'com.google.dagger:dagger-android:2.10'
      compile 'com.google.dagger:dagger-android-support:2.10'
      annotationProcessor 'com.google.dagger:dagger-android-processor:2.10'
  
      compile "com.android.support:appcompat-v7:$supportLibraryVersion"
      compile "com.android.support:design:$supportLibraryVersion"
      compile "com.android.support.constraint:constraint-layout:1.0.2"
  
      compile "com.jakewharton.timber:timber:4.5.1"
      compile "com.squareup.phrase:phrase:1.1.0"
      compile "com.squareup.retrofit2:retrofit:2.2.0"
      compile "com.squareup.retrofit2:converter-gson:2.2.0"
      compile "com.squareup.okhttp3:logging-interceptor:3.7.0"
      compile 'net.danlew:android.joda:2.9.9'
  
      testCompile 'junit:junit:4.12'
      compile 'com.google.firebase:firebase-crash:10.2.4'
      androidTestCompile 'junit:junit:4.12'
  }
  
  apply plugin: 'com.google.gms.google-services'
  </code></pre>
  
  <p>build.gradle:</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  
  buildscript {
      repositories {
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:2.4.0-alpha7'
          classpath 'com.google.gms:google-services:3.0.0'
          // Plugin to run test coverage report on unit tests (not instrumentation)
          classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.5.0'
      }
  }
  
  plugins {
      // Highlights dependencies on libraries where a newer version is available
      id 'com.github.ben-manes.versions' version '0.14.0'
  }
  
  allprojects {
      repositories {
          jcenter()
      }
  }
  
  task clean(type: Delete) {
      delete rootProject.buildDir
  }
  
  // Configure dependencyUpdates task to look on release versions only, not beta etc
  dependencyUpdates.resolutionStrategy = {
      componentSelection { rules -&gt;
          rules.all { ComponentSelection selection -&gt;
              boolean rejected = ['preview', 'alpha', 'beta', 'rc', 'cr'].any { qualifier -&gt;
                  selection.candidate.version ==~ /(?i).*[.-]${qualifier}[.\d-]*/
              }
              if (rejected) {
                  selection.reject('Release candidate')
              }
          }
      }
  }
  
  apply plugin: 'com.vanniktech.android.junit.jacoco'
  </code></pre>