欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Android Studio 4.0 设置代理proxy和maven

程序员文章站 2022-05-04 07:56:57
...

系统 Windows 10

Android Studio 4.0.1

1.设置proxy,能够使得下载SDK,NDK等速度变快。File->Settings 然后可以看到下面页面

下面这张图修改的是局部,全局文件位置为

C:\Users\UserName\.gradle\gradle.properties

Android Studio 4.0 设置代理proxy和maven

2.设置maven能使项目build时安装依赖项的速度提高

Android Studio 4.0 设置代理proxy和maven

build.gradle(Project:XXXXXX)

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        maven{
            url "https://maven.aliyun.com/groups/public"
        }
        maven {
            url "https://maven.aliyun.com/repository/google"
        }
        maven {
            url "https://maven.aliyun.com/repository/jcenter"
        }
//        google()
//        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // 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/groups/public"
        }
        maven {
            url "https://maven.aliyun.com/repository/google"
        }
        maven {
            url "https://maven.aliyun.com/repository/jcenter"
        }

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

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

 

参考文献:

1.Android Studio设置http proxy加速下载(亲测有效)

2.Android Studio使用Maven国内镜像

3.Android Studio proxy的设置玄学

4.阿里云Android SDK 3.0配置

相关标签: android