当前位置:   article > 正文

Android Studio配置中“Gradle sync failed: SSL peer shut down incorrectly”或者“Read timed out”解决办法_安卓 ssl peer shut down incorrectly

安卓 ssl peer shut down incorrectly

Android Studio配置中“Gradle sync failed: SSL peer shut down incorrectly”或者“Read timed out”解决办法

出现SSL peer shut down incorrectly或者Read timed out的问题

解决方法:使用阿里镜像或者gradle离线build

解决方式1

打开工程目录下的build.gradle文件,不是app下的build.gradle

img

修改build.gradle文件成如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        //google()
        //jcenter()
        maven { url 'https://maven.aliyun.com/repository/public/' }
        maven { url 'https://maven.aliyun.com/repository/google/'}
        maven { url 'https://maven.aliyun.com/repository/jcenter/'}
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        //google()
        //jcenter()
        maven { url 'https://maven.aliyun.com/repository/public/' }
        maven { url 'https://maven.aliyun.com/repository/google/'}
        maven { url 'https://maven.aliyun.com/repository/jcenter/'}
        mavenLocal()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

添加如下代码即可解决问题

maven { url 'https://maven.aliyun.com/repository/public/' }
maven { url 'https://maven.aliyun.com/repository/google/'}
maven { url 'https://maven.aliyun.com/repository/jcenter/'}
  • 1
  • 2
  • 3

解决方式2

将Android Studio的gradle的方式改成离线即可。

已经运行过的项目或者是将包放到相应的位置后,就可以用离线的方式。

参考

参考来源

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/504015
推荐阅读
相关标签
  

闽ICP备14008679号