自学内容网 自学内容网

Android Studio | 修改镜像地址为阿里云镜像地址,启动App

  1. 在项目文件的目录下的 settings.gradle.kts 中修改配置,配置中包含插件和依赖项
    pluginManagement {
        repositories {
            maven { url=uri ("https://www.jitpack.io")}
            maven { url=uri ("https://maven.aliyun.com/repository/releases")}
            maven { url=uri ("https://maven.aliyun.com/repository/google")}
            maven { url=uri ("https://maven.aliyun.com/repository/central")}
            maven { url=uri ("https://maven.aliyun.com/repository/gradle-plugin")}
            maven { url=uri ("https://maven.aliyun.com/repository/public")}
            google()
            mavenCentral()
            gradlePluginPortal()
        }
    }
    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            maven { url=uri ("https://www.jitpack.io")}
            maven { url=uri ("https://maven.aliyun.com/repository/releases")}
            maven { url=uri ("https://maven.aliyun.com/repository/google")}
            maven { url=uri ("https://maven.aliyun.com/repository/central")}
            maven { url=uri ("https://maven.aliyun.com/repository/gradle-plugin")}
            maven { url=uri ("https://maven.aliyun.com/repository/public")}
            google()
            mavenCentral()
        }
    }
    
    rootProject.name = "My Application" # 这里的 My Application 是项目名称
    include(":app")
     

  2. 打开项目文件下的 gradle → wrapper →  gradle-wrapper.properties 修改镜像地址
    distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.9-bin.zip


原文地址:https://blog.csdn.net/Qj60776671/article/details/143704140

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!