简体   繁体   中英

Android Studio 3.1.3 Gradle sync failed

Good morning.

I am going to develop Android on my company.

I downloaded Android Studio 3.1 and created a new blank project I get an error.

Gradle download will cause an unconditional error.

I referenced a lot of Google stuff, but I could not solve it.

Help.

  1. build.gradle(root)

buildscript {

 repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.3' } allprojects { repositories { google() jcenter() } 

}

  1. build.gradle(project)
 dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:28.+' } 
  1. gradle.wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip

  1. HTTP Proxy Setting

    • Automatic proxy settings check
  2. Gradle Sync Exception

    • Caused by: java.net.ConnectException: Connection timed out: connect

Try this:

Android Studio -> File -> Settings -> Gradle -> Check Offline work -> press ok then sync project

Got this error log after checked "offline mode" option: No cached version of com.android.tools.build:gradle:3.2.0-beta03 available for offline mode. Disable Gradle 'offline mode' and sync project

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM