装置Android Studio
可参考:android studio的装置,史上最具体(超多图)!!
装置胜利后、第一次运行程序会进行gradle,可能产生报错:SSL peer shut down incorrectly
"SSL peer shut down incorrectly"的解决办法
解决办法可参考:
①联网:AndroidStudio SSL peer shut down incorrectly 问题
②本地:Android Studio应用本地Gradle的配置
联网法
- 在侧边文件栏在
Gradle Scripts
下找到build.gradle
这个文件,双击编辑。 - 在以下两处增加
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript { repositories { google() maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } //此处增加 jcenter() } dependencies { classpath "com.android.tools.build:gradle:4.1.1" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }}allprojects { repositories { google() maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' } //此处增加 jcenter() }}task clean(type: Delete) { delete rootProject.buildDir}
保留后,点击上方Try again
或敞开Android Studio再关上,期待下载实现即可。
本地法
- 下载gradle到本地:下载gradle
- 将
gradle-wrapper.properties
文件中最初一行distributionUrl=......
批改如下:
distributionUrl=file:///门路
如
distributionUrl=file:///D:/Android/gradle/gradle-6.8.1-all.zip
- 将
build.gradle
文件批改如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript { repositories { google() jcenter() } dependencies { classpath "com.android.tools.build:gradle:4.1.1" //这里不能改,就是Android Studio的版本,而不是gradle的版本 }}allprojects { repositories { google() jcenter() }}task clean(type: Delete) { delete rootProject.buildDir}
保留后,点击上方Try again
或敞开Android Studio再关上,期待下载实现即可。