0

I have installed Android Studio on my Mac. After installing, I simply created an application with an empty Activity. No coding, nothing I implemented, just checking my Android Studio. Tried to run that and am getting these errors:

Error: Read timed out 
FAILURE: Build failed with an exception.

A problem occurred configuring root project 'MyApplication'.

Could not resolve all artifacts for configuration ':classpath'. Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.3.1/builder-3.3.1.jar'. *Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more logout. Run with --scan to get full insights. -Get more help at https://help.gradle.org BUILD FAILED in 57s Read timed out

I have tried installing all the Gradles, 3.3.1, 4010.0, 3.5.1. I have changed the Gradle version in build.gradle and installed all Gradle versions and checked all. Still, it's not working. I am getting the same error. Earlier, I got the "unable to find the trusted certificate to requested target" but solved that by adding the certificate to the keystore. Now I am unable to understand why this error is so difficult to fix. It's just an empty Activity application with no implementation.

0xCursor
  • 2,242
  • 4
  • 15
  • 33

1 Answers1

0

Firstly, ensure that your have your google() properly configured in your repositories{}, i.e.

repositories {
    google() // make this repo as the first one if Android Gradle Plugin is upgraded from 2.x to 3.x. 
    jcenter()
    mavenCentral()
}

See https://stackoverflow.com/a/51151050/8034839 for more detailes.

Secondly, Check your Proxy for gradle

Under your Android project root directory, find gradle.properties file and add below settings:

systemProp.http.proxyHost=my-example-proxy.com
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=my-example-proxy.com
systemProp.https.proxyPort=8080
# Add all your hosts that should be bypassed by your proxy server.
systemProp.https.nonProxyHosts=localhost

Note that this proxy setting will apply to your gradle build commands as well.

shizhen
  • 12,251
  • 9
  • 52
  • 88