Android Gradle 同步错误:读取超时



当我在Android Studio中同步Gradle项目时遇到此错误。

读取超时

我也尝试过这个答案中提到的,但没有运气。一切都很好,直到我将Android Studio更新到3.2。

  • 安卓插件版本:3.2.0
  • 格拉德尔版本:4.6

编辑:

build.gradle (项目:FOTS(

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

build.gradle (Module:app(

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.biocare.fots"
minSdkVersion 19
targetSdkVersion 28
versionCode 29
versionName "2.1.0"
}
buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.10'
implementation 'com.jakewharton:butterknife:8.6.0'
implementation 'com.google.firebase:firebase-messaging:17.3.3'
annotationProcessor 'com.jakewharton:butterknife:8.6.0'
annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'
implementation 'android.arch.persistence.room:runtime:1.1.1'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'android.arch.lifecycle:viewmodel:1.1.1'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.android.support:gridlayout-v7:28.0.0'
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'

您是否使用任何代理或防火墙,因为可能是构建同步的原因?如果您不使用,请选择菜单项:文件 -> 使缓存失效/重新启动...来修复它。

您必须先验证您的互联网连接。 检查任何防病毒软件或防火墙,尝试禁用所有这些防病毒软件或防火墙。 检查您的成绩是否离线,它应该在线。 如果 None 有效,请尝试使用一些 VPN,它有时有效。

我可以了解你们的下载速度吗?最有可能的是,当您的IDE下载软件包时,您的互联网连接不稳定,大约~20kbps。这是一种耻辱,像微软,谷歌,Jetbrains,npm这样的公司和社区不关心互联网速度,也没有机会拥有离线软件包,以确保为互联网连接不佳的开发人员提供稳定的环境。

最新更新