AndroidStudio中遇到Error:SSL peer shut down incorrectly,解决方案

这几天在研究Retrofit 框架的使用,github上下载demo后,导入项目时报错 Error:SSL peer shut down incorrectly ,也是在网上查找了好多博客,最后总结一下这个问题的解决办法,希望对遇到同样问题的朋友们有所帮助:

我使用的Android Studio 版本为2.3.3,开始以为是版本问题,后来经过其他博主的文章发现并不是这个原因造成的。

其中文章最多的答案便是 对照着本地可运行项目的配置参数对应修改 ,但不甚明确,大概猜到需要修改的地方只有两处,即两个.gradle文件,Android Studio 2.3.3 对应的gradle版本最低是3.3,如果没有需要到 http://services.gradle.org/distributions

这个地址去下载对应的版本,然后放在对应的安装AS位置下的Gradle的包下(若不清楚放在哪个位置下,可自行百度),然后还需要在File--Setting 中,如下图做下设置,同样,在该项目的配置中再确定下版本。

 以上都修改完了,再次Builde。

我按照以上步骤修改完,依然还是报错,但是为什么呢,接下来就是需要修改两处的.gradle文件了(是因为Google的一个地址无法访问,所导致出现的这个问题):

我project中的gradle文件

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
        classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0"
    }
}

allprojects {
    repositories {
        maven { url 'https://maven.google.com/' }
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

只需要把 其中的

 maven {
            url 'https://maven.google.com/'
            name 'Google'
        }

改为

maven {
    url 'https://dl.google.com/dl/android/maven2/'
    name 'Google'
}
再次编译即可解决问题!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值