Android Gradle 同步错误 : Read timed out

标签 android android-studio gradle android-gradle-plugin

<分区>

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

Read timed out

我也试过这个 answer 中提到的但没有运气。一切正常,直到我将 Android Studio 更新到 3.2。

  • 安卓插件版本:3.2.0
  • Gradle 版本: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(模块:应用程序)

    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'

最佳答案

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

关于Android Gradle 同步错误 : Read timed out,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52612514/

相关文章:

android - 通过 ADB 在设备中导航

gradle - 使用其中的Groovy扩展方法构建项目

java - 如何从 Android Studio 中的文件夹附加 jar 库的源代码?

java - 使用 Proguard 转换类和资源时出错

Android Studio 和 SVN - 并非每个文件/文件夹都会提交

gradle - Gradle 构建中未解析的 Kotlin 扩展函数引用

android - 无法解决错误属性 Alpha 未找到

android - 升级到 v0.19.0 后如何禁用拖动 Compose 寻呼机?

android - SurfaceView 隐藏屏幕上的其他组件

android - 以 WebService 为源的 ContentProvider