Android开发时如果grade文件中的 google() 和 jcenter() 连接不上的时候,可以试试阿里提供的相应镜像的公共代理库。

https://help.aliyun.com/document_detail/102512.html

buildscript {
    ext{
        // Sdk and tools
        compileSdkVersion = 28
        minSdkVersion = 21
        targetSdkVersion = 28

        // App dependencies
        kotlin_version = '1.3.20'
        kotlinx_coroutines_version = '1.1.1'
        navigation_version = '1.0.0-alpha11'
        navigation_ktx_version = '1.0.0-alpha11'

        androidx_appcompat_version = '1.0.2'
        androidx_constraintlayout_version = '2.0.0-alpha2'
        androidx_legacy_v4_version = '1.0.0-alpha1'
        androidx_core_ktx = '1.0.1'
        androidx_recyclerview = '1.0.0'

        roomVersion = '2.1.0-alpha02'
        workVersion = '1.0.0-beta03'
        pagingVersion = '2.1.0'
        recyclerviewVersion = '1.0.0'
        swiperefreshlayoutVersion = '1.0.0'

    }
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        // Safe args
        classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$navigation_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/jcenter' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
        maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
        maven { url 'https://jitpack.io' }
    }
}