安卓项目加载慢,甚至出现加载错误Could not find kotlin-stdlib-1.8.20.jar (org.jetbrains.kotlin:kotlin-stdlib:1.8.20)

可以添加或者更新阿里仓库镜像:

阿里云云效 Maven:https://developer.aliyun.com/mvn/guide

1. settings.gradle 版本

pluginManagement {
    
    
    repositories {
    
    
        maven {
    
    
            url 'https://maven.aliyun.com/repository/central'
            allowInsecureProtocol = true
        }
        maven {
    
    
            url 'https://maven.aliyun.com/repository/public'
            allowInsecureProtocol = true
        }
        maven {
    
    
            url 'https://maven.aliyun.com/repository/gradle-plugin'
            allowInsecureProtocol = true
        }
        maven {
    
    
            url 'https://maven.aliyun.com/repository/apache-snapshots'
            allowInsecureProtocol = true
        }
        google()
        mavenCentral()
        gradlePluginPortal()
        maven {
    
    
            url 'https://www.jitpack.io'
        }
    }
}

2. settings.gradle.kts 版本

pluginManagement {
    
    
    repositories {
    
    
        maven(url = "https://maven.aliyun.com/repository/central") {
    
    
            isAllowInsecureProtocol = true
        }
        maven(url = "https://maven.aliyun.com/repository/public") {
    
    
            isAllowInsecureProtocol = true
        }
        maven(url = "https://maven.aliyun.com/repository/gradle-plugin") {
    
    
            isAllowInsecureProtocol = true
        }
        maven(url = "https://maven.aliyun.com/repository/apache-snapshots") {
    
    
            isAllowInsecureProtocol = true
        }
        google()
        mavenCentral()
        gradlePluginPortal()
        maven(url = "https://www.jitpack.io")
    }
}

代码表示在Gradle构建中添加了一个名为maven的Maven仓库。通过url属性指定了仓库的URL地址为https://maven.aliyun.com/repository/…,即阿里云的Maven仓库。

allowInsecureProtocol属性被设置为true,表示允许使用不安全的协议进行下载,例如使用HTTP而不是HTTPS。

猜你喜欢

转载自blog.csdn.net/qq_42751010/article/details/134834247
今日推荐