title: Running Android Studio behind a corporate proxy: Unable to resolve dependency
body: <p>I’m running Android Studio 3.3 installed on a company system, connected to the company’s proxy. Whenever I try to execute <code>Make Project</code>, I get the following errors:</p>
  
  <p><code>ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0-rc02.</code></p>
  
  <p><code>ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:design:28.0.0-rc02.</code></p>
  
  <p>I've tried the following:</p>
  
  <ul>
  <li>Set Hostname (xx.x.x.xxx), Port (8080), Login and Password in <code>Settings &gt; Appearance &amp; Behavior &gt; System Settings &gt; HTTP Proxy</code> and checked <code>Proxy authentication</code>.
  
  <ul>
  <li>My password contains a special character ($), I've written it without any change.</li>
  <li>When I click on <code>Check Connection</code> and enter <a href="http://www.google.com" rel="nofollow noreferrer">http://www.google.com</a>, it shows me this error: <code>Problem with connection: Connection reset</code>. I'm able to access this URL after entering proxy credentials in my browser (Google Chrome).</li>
  </ul></li>
  <li><p>Modified my <code>build.gradle</code> as shown below to resolve repository errors. Also checked <code>Enable embedded Maven repository</code> under <code>Settings &gt; Build, Execution, Deployment &gt; Gradle &gt; Android Studio</code>.</p></li>
  <li><p>Added the top level certificate to Android Embedded JRE's <code>cacerts</code> file using KeyStore Explorer. I'm using the embedded JDK bundled with Android Studio.</p></li>
  <li>Added proxy settings to <code>gradle-wrapper.properties</code> file as shown below.</li>
  </ul>
  
  <p>I also tried to run an http request code on <code>IntelliJ IDEA Community 2018.3.3</code>, configuring the same proxy settings. The code runs with no errors in my personal computer (on open network) but gives me a <code>Connection timed out: connect</code> error when I run the same code on the company system (connected to proxy). </p>
  
  <p>This might indicate the problem originates from IntelliJ, since Android Studio is based on it. Switching to open network on the company system is not an option.</p>
  
  <p><strong>Note</strong>: I can access <a href="https://dl.google.com/dl/android/maven2/index.html" rel="nofollow noreferrer">Google's Maven Repository</a> from the browser so I don't think the proxy is blocking the URL.</p>
  
  <p>Related issue on jetbrains: <a href="https://youtrack.jetbrains.com/issue/IDEA-153423" rel="nofollow noreferrer">https://youtrack.jetbrains.com/issue/IDEA-153423</a><br>
  How can I solve the dependency errors on the company system's Android Studio?</p>
  
  <p>Relevant code from my main <code>build.gradle</code>:</p>
  
  <pre><code>buildscript {
      repositories {
          mavenLocal()
          mavenCentral()
          google()
          jcenter()
      }
      dependencies {
          classpath 'com.android.tools.build:gradle:3.3.0'
      }
  }
  
  allprojects {
      repositories {
          maven { url "https://maven.google.com"}
          mavenLocal()
          mavenCentral()
          maven { url "http://jcenter.bintray.com"}
          google()
          jcenter()
      }
  }
  </code></pre>
  
  <p>Relevant code from my app <code>build.gradle</code>:</p>
  
  <pre><code>apply plugin: 'com.android.application'
  android {
      compileSdkVersion 28
      defaultConfig {
          minSdkVersion 21
          targetSdkVersion 28
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
  }
  
  dependencies {
      implementation fileTree(dir: 'libs', include: ['*.jar'])
      implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
      implementation 'com.android.support:design:28.0.0-rc02'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'com.android.support.test:runner:1.0.2'
      androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  }
  </code></pre>
  
  <p>Relevant code from my app <code>gradle-wrapper.properties</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>distributionBase=GRADLE_USER_HOME
  distributionPath=wrapper/dists
  zipStoreBase=GRADLE_USER_HOME
  zipStorePath=wrapper/dists
  distributionUrl=http\://services.gradle.org/distributions/gradle-4.10.1-all.zip
  
  systemProp.proxySet="true"
  systemProp.http.keepAlive="true"
  systemProp.http.proxyHost=&lt;xx.x.x.xxx&gt;
  systemProp.http.proxyPort=8080
  systemProp.http.proxyUser=&lt;username&gt;
  systemProp.http.proxyPassword=&lt;password, has $ character in it&gt;
  
  systemProp.https.keepAlive="true"
  systemProp.https.proxyHost=&lt;xx.x.x.xxx&gt;
  systemProp.https.proxyPort=8080
  systemProp.https.proxyUser=&lt;username&gt;
  systemProp.https.proxyPassword=&lt;password, has $ character in it&gt;
  </code></pre>