title: How do I cause gradle command-line builds to install multidex from a clean build?
body: <p>I'm having issues trying to do a command line build of our Android project from a clean build (for Jenkins CI). If I open the project in Android Studio and run <code>Tools &gt; Android &gt; Sync Project with Gradle Files</code>, I can subsequently build from the command line. However if I try to run <code>./gradlew build</code> from the command line without first opening the project in Android Studio, I receive the following build failure:</p>
  
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  A problem occurred configuring project ':Redacted'.
  &gt; Could not resolve all dependencies for configuration ':Redacted:_debugCompile'.
     &gt; Could not find com.android.support:multidex:1.0.0.
       Searched in the following locations:
           https://repo1.maven.org/maven2/com/android/support/multidex/1.0.0/multidex-1.0.0.pom
           https://repo1.maven.org/maven2/com/android/support/multidex/1.0.0/multidex-1.0.0.jar
           https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex-1.0.0.pom
           https://jcenter.bintray.com/com/android/support/multidex/1.0.0/multidex-1.0.0.jar
           http://download.crashlytics.com/maven/com/android/support/multidex/1.0.0/multidex-1.0.0.pom
           http://download.crashlytics.com/maven/com/android/support/multidex/1.0.0/multidex-1.0.0.jar
       Required by:
           RedactedAndroid:Redacted:unspecified
     &gt; Could not find any version that matches com.android.support:support-v4:21.0.+.
       Searched in the following locations:
           https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
           https://repo1.maven.org/maven2/com/android/support/support-v4/
           https://jcenter.bintray.com/com/android/support/support-v4/maven-metadata.xml
           https://jcenter.bintray.com/com/android/support/support-v4/
           http://download.crashlytics.com/maven/com/android/support/support-v4/maven-metadata.xml
           http://download.crashlytics.com/maven/com/android/support/support-v4/
       Required by:
           RedactedAndroid:Redacted:unspecified
     &gt; Could not find any version that matches com.android.support:appcompat-v7:21.0.+.
       Searched in the following locations:
           https://repo1.maven.org/maven2/com/android/support/appcompat-v7/maven-metadata.xml
           https://repo1.maven.org/maven2/com/android/support/appcompat-v7/
           https://jcenter.bintray.com/com/android/support/appcompat-v7/maven-metadata.xml
           https://jcenter.bintray.com/com/android/support/appcompat-v7/
           http://download.crashlytics.com/maven/com/android/support/appcompat-v7/maven-metadata.xml
           http://download.crashlytics.com/maven/com/android/support/appcompat-v7/
       Required by:
           RedactedAndroid:Redacted:unspecified
     &gt; Could not find any version that matches com.google.android.gms:play-services:6.5+.
       Searched in the following locations:
           https://repo1.maven.org/maven2/com/google/android/gms/play-services/maven-metadata.xml
           https://repo1.maven.org/maven2/com/google/android/gms/play-services/
           https://jcenter.bintray.com/com/google/android/gms/play-services/maven-metadata.xml
           https://jcenter.bintray.com/com/google/android/gms/play-services/
           http://download.crashlytics.com/maven/com/google/android/gms/play-services/maven-metadata.xml
           http://download.crashlytics.com/maven/com/google/android/gms/play-services/
       Required by:
           RedactedAndroid:Redacted:unspecified
     &gt; Could not find any version that matches com.android.support:support-v4:[21,22).
       Required by:
           RedactedAndroid:Redacted:unspecified &gt; com.facebook.android:facebook-android-sdk:3.22.0
     &gt; Could not find any version that matches com.android.support:appcompat-v7:21.+.
       Required by:
           RedactedAndroid:Redacted:unspecified &gt; com.uservoice:uservoice-android-sdk:1.2.2
     &gt; Could not find com.android.support:support-v4:21..
       Searched in the following locations:
           https://repo1.maven.org/maven2/com/android/support/support-v4/21./support-v4-21..pom
           https://repo1.maven.org/maven2/com/android/support/support-v4/21./support-v4-21..jar
           https://jcenter.bintray.com/com/android/support/support-v4/21./support-v4-21..pom
           https://jcenter.bintray.com/com/android/support/support-v4/21./support-v4-21..jar
           http://download.crashlytics.com/maven/com/android/support/support-v4/21./support-v4-21..pom
           http://download.crashlytics.com/maven/com/android/support/support-v4/21./support-v4-21..jar
       Required by:
           RedactedAndroid:Redacted:unspecified &gt; com.uservoice:uservoice-android-sdk:1.2.2
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
  
  BUILD FAILED
  </code></pre>
  
  <p>To my knowledge, I have all the proper dependencies specified in my Gradle scripts:</p>
  
  <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules.
  buildscript {
      repositories {
          mavenCentral()
          maven { url 'http://download.crashlytics.com/maven' }
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:1.0.0'
          classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
      }
  }
  </code></pre>
  
  <p>And my app-level Gradle script:</p>
  
  <pre><code>...
  dependencies {
      ...
      compile 'com.android.support:multidex:1.0.0'
      ...
  }
  
  android {
  ...
  </code></pre>
  
  <p>Also, some of the contents of .gitignore:</p>
  
  <pre><code># Android Studio and Gradle
  build/
  local.properties
  .gradle
  gradle-app.setting
  *.iml
  .idea/
  *.ipr
  *.iws
  out/
  .idea_modules/
  </code></pre>
  
  <p>Why can't multidex be found from a clean command line build and how do I fix this issue?</p>