• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

gradle从7.0.2降级到6.5 报错

武飞扬头像
cxm1995
帮助1

gradle-wrapper.properties修改

前:distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
后:distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

报错 :

A problem occurred evaluating settings 'zDelete'.
> Could not find method dependencyResolutionManagement() for argument.....

原因:gradle 从6.8开始引入了,依赖解析管理。

删除settings.gradle 中 依赖解析管理相关的设置

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        谷歌()
        mavenCentral()
        jcenter() // Warning: this repository is going to shut down soon
    }
}

报错:Minimum supported Gradle version is 7.0.2. Current version is 6.5.

原因:忘了改buil.gradle(project) 中的 classpath "com.android.tools.build:gradle:7.0.0"

改为  classpath "com.android.tools.build:gradle:4.1.3"

运行报错,发现各种依赖找不到。

: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugNativeLibs'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Cannot resolve external dependency org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.20 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency androidx.core:core-ktx:1.6.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency androidx.appcompat:appcompat:1.3.1 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency com.谷歌.android.material:material:1.4.0 because no repositories are defined.
     Required by:
         project :app
   > Cannot resolve external dependency androidx.constraintlayout:constraintlayout:2.1.0 because no repositories are defined.
     Required by:
         project :app
原因:没有设置依赖仓库添加

在buil.gradle(project)

allprojects {
    repositories {
        谷歌()
        mavenCentral()
    }
}

能运行了

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgfgakh
系列文章
更多 icon
同类精品
更多 icon
继续加载