Could not resolve all files for configuration ‘:app:debugRuntimeClasspath‘. >找不到maven包

前言

在build.gradle中引入Fetch时,提示找不到包,引入方式正确、版本也正确,后来发现是仓库里缺少东西。

修改前

新建项目时,setting.gradle

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()

    }
}
rootProject.name = "FetchDemo"
include ':app'

项目的build.gradle如下:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.1.1' apply false
    id 'com.android.library' version '7.1.1' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

修改后

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // 引入
        jcenter()
        maven { url 'https://jitpack.io'}
    }
}
rootProject.name = "FetchDemo"
include ':app'


版权声明:本文为baidu_33256174原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。