Cause 1: org.gradle.internal.res

作者: zhongjh | 来源:发表于2022-07-27 10:23 被阅读0次

    这是找不到相关地址下载。

    1 旧版的

    其实增加阿里云的镜像地址即可,在项目的根目录下的build.gradle增加如下代码:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    buildscript {
        repositories {
            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' }
            jcenter()
            maven { url "https://jitpack.io" }
        }
    }
    
    allprojects {
        repositories {
            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' }
            jcenter()
            maven { url "https://jitpack.io" }
        }
    }
    

    2 新版的

    如果是新版的配置文件,配置地方变化了。在项目的根目录下的settings.gradle修改相关代码如下:

    pluginManagement {
        repositories {
            gradlePluginPortal()
            google()
            mavenCentral()
            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" }
        }
    }
    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
            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" }
        }
    }
    rootProject.name = "My Application"
    include ':app'
    
    

    相关文章

      网友评论

        本文标题:Cause 1: org.gradle.internal.res

        本文链接:https://www.haomeiwen.com/subject/ngxzirtx.html