Android Studio Connect to repo.maven.apache.org:443 failed: Connection time

Disclaimer: This blog post refers to the setting of the Alibaba Cloud mirror proxy in Android Studio (if the remote warehouse download fails after setting, please read the content carefully to solve the problem). If the original blog owner thinks it is infringing, please contact, and the blog will be deleted.

Purpose: To facilitate people who encounter similar problems and avoid detours.

Question: As shown in the picture:

 Solution: Follow the method mentioned in Android Studio to set the Alibaba Cloud mirror agent (if the remote warehouse download fails after setting, please read the content carefully) . Modify the build.gradle of the entire project in two places, as follows:

buildscript {
    repositories {
        maven{ url 'https://maven.aliyun.com/repository/google'} //修改1
        maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} //修改1
        maven{ url 'https://maven.aliyun.com/repository/public'} //修改1
        maven{ url 'https://maven.aliyun.com/repository/jcenter'} //修改1
        google()
        mavenCentral()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.2.2"
        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/repository/google'} //修改2
        maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} //修改2
        maven{ url 'https://maven.aliyun.com/repository/public'} //修改2
        maven{ url 'https://maven.aliyun.com/repository/jcenter'} //修改2
        google()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
    }
}

The specific location of the file is shown in the figure below:

 

Guess you like

Origin blog.csdn.net/afunx/article/details/129913028