flutter ‘Gradle Libs‘ was added by build file ‘app/build.gradle‘

相关问题解释文章

How to prefer settings.gradle repositories over build.gradle
repositoriesMode 解释

问题描述

此问题是,直接创建的flutter项目,需要配置其他的maven仓库地址,和第三方module,结果始终都是无法成功

错误异常信息
Build was configured to prefer settings repositories over project repositories but repository
 'Gradle Libs' was added by build file 'app/build.gradle'
解决方案

找到你的flutter sdk的路径,找到 settings.gradle.kts文件

xxxxxx\flutter\packages\flutter_tools\gradle\settings.gradle.kts
修改为如下配置
dependencyResolutionManagement {
  repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
  repositories {
    google()
    mavenCentral()
  }
}

主要原因是配置这个选择项目,FAIL_ON_PROJECT_REPOS,任何直接在项目中声明的第三方仓库,都是无法使用的

我的博客

简书
csdn

你可能感兴趣的:(flutter)