安卓第一课:gradle仓库的导入

今天装好android studio,结果刚进入就报错了:

SSL peer shut down incorrectly

读注释发现原来是gradle下载文件不成功。果然,原来是vpn掉线了,上网查了查,原来国内都用阿里的仓库下载,而国外是直接从谷歌的maven仓库下载。

换仓库,直接在settings.gradle里改成:

pluginManagement {
    repositories {
        maven { url 'http://maven.aliyun.com/repositories/public/' }
        maven { url 'http://maven.aliyun.com/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/repositories/google' }
        maven { url 'http://maven.aliyun.com/repositories/gradle-plugin' }
        mavenLocal()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        maven { url 'http://maven.aliyun.com/repositories/public/' }
        maven { url 'http://maven.aliyun.com/repositories/jcenter' }
        maven { url 'http://maven.aliyun.com/repositories/google' }
        maven { url 'http://maven.aliyun.com/repositories/gradle-plugin' }
        mavenLocal()
        mavenCentral()
    }
}

  

posted @ 2022-11-21 23:26  姜劭  阅读(120)  评论(0编辑  收藏  举报