Android Studio 安装及配置镜像

#   1、首先下载Android studio安装包

2、下载好该安装包之后,点击进行安装,依次出现以下界面

 

  

在这里自己选择程序安装路径

这里Android studio程序安装完毕,但是还需要继续对其进行配置;勾选Start Android Studio,然后点击finish启动AS,出现下图

 

 

 

 

选择第二项,然后点击ok,出现下面的启动界面

在启动的时候会弹出下图

点击cancel,然后进入到了AS的安装向导界面

点击next进入UI界面主题选择界面,可以选择自己喜欢的风格,这里选择Darcula风格

这里需要指定SDK的本地路径,如果之前电脑中已经存在SDK,可以指定该路径,后续就可以不用下载SDK;我这里演示本地没有安装过SDK的场景,这里暂时可以指定一个后续将保存SDK的路径;

点击Finish后,开始自动下载SDK(注意,此时需要保证电脑联网)

 

 

 

下载完成SDK后,点击Finish进入AS的欢迎界面

3.更改下载镜像

buildscript {

    repositories {
        //阿里云地址
        

    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
    maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }


} dependencies { classpath
'com.android.tools.build:gradle:3.0.0' // 注册MobSDK classpath "com.mob.sdk:MobSDK:2018.0319.1724" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { //阿里云地址 maven{ url 'http://maven.aliyun.com/nexus/content/groups/public/'} maven{url 'https://jitpack.io'} maven { url 'https://maven.google.com' } } }

 

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven {
            url 'https://maven.aliyun.com/repository/jcenter'
        }
        maven {
            url 'https://maven.aliyun.com/repository/google'
        }

        //google()
        //jcenter()
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            url 'https://maven.aliyun.com/repository/jcenter'
        }
        maven {
            url 'https://maven.aliyun.com/repository/central'
        }
        maven {
            url 'https://maven.aliyun.com/repository/google'
        }

        //google()
        //jcenter()
        
    }
}

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

 

 

在 .gradle (路径参考 C:\Users\username\.gradle )目录下新增 init.gradle 文件,内容如下: 

allprojects{
    repositories {
        def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
        def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
        all { ArtifactRepository repo ->
            if(repo instanceof MavenArtifactRepository){
                def url = repo.url.toString()
                if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('http://repo1.maven.org/maven2')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                    remove repo
                }
                if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('http://jcenter.bintray.com/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                    remove repo
                }
            }
        }
        maven {
            url ALIYUN_REPOSITORY_URL
            url ALIYUN_JCENTER_URL
        }
    }


    buildscript{
        repositories {
            def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
            def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
            all { ArtifactRepository repo ->
                if(repo instanceof MavenArtifactRepository){
                    def url = repo.url.toString()
                    if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('http://repo1.maven.org/maven2')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                        remove repo
                    }
                    if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('http://jcenter.bintray.com/')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                        remove repo
                    }
                }
            }
            maven {
                url ALIYUN_REPOSITORY_URL
                url ALIYUN_JCENTER_URL
            }
        }
    }
}

 

posted @ 2020-05-13 21:11  Sapphire!  阅读(9860)  评论(0编辑  收藏  举报