Could not resolve all files for configuration

关于作者:CSDN内容合伙人、技术专家, 从零开始做日活千万级APP。
专注于分享各领域原创系列文章 ,擅长java后端、移动开发、商业变现、人工智能等,希望大家多多支持。
未经允许不得转载

在这里插入图片描述

一、导读

我们继续总结学习开发中遇到的问题,温故知新,避免跳坑里。

今天遇到一个编译问题,打包就失败,比较坑,在此做一个记录,防止掉坑。

本文记录一次解决的过程,

Execution failed for task ‘:app:checkReleaseDuplicateClasses’.

Could not resolve all files for configuration ‘:appReleaseRuntimeClasspath’.

Failed to transform xxx-4.3.1.8.aar (com.txxx:xxx:4.3.1.8) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.

Could not find xxx-4.3.1.8.aar (com.xxx:xxx:4.3.1.8).

二、概览

背景是这样的,一直都编译的好好的项目突然报错,报错日志如下:


FAILURE: Build completed with 9 failures.

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:checkReleaseDuplicateClasses'.
> Could not resolve all files for configuration ':appReleaseRuntimeClasspath'.
   > Failed to transform xxx-4.3.1.8.aar (com.txxx:xxx:4.3.1.8) to match attributes {
    
    artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not find xxx-4.3.1.8.aar (com.xxx:xxx:4.3.1.8).
        Searched in the following locations:
            https://maven.aliyun.com/nexus/content/groups/public/xxxisk-4.3.1.8.aar
            https://maven.aliyun.com/nexus/content/groups/public/xxxisk-4.3.1.8.jar

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================

* Get more help at https://help.gradle.org

BUILD FAILED in 49s

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
182 actionable tasks: 164 executed, 18 up-to-date
14:29:31: Execution finished 'assembleFastreaderRelease'.

后来想了想,原因是我升级了一个三方sdk的版本号,4.3.1.6 -> 4.3.1.8 , 也就升级了下版本,咋就下载不了呢?
我们正常点aar的链接是可以正常下载包的, 于是我用三方的demo打包试了试,发现他们可以下载,正常打包,经过排查,
发现是gradle版本不一样,

于是,将版本号改成一样,就能正常下载了,还真tn的神奇,当然也没去细究为啥这样。

gradle-7.5.1-bin.zip -> gradle-7.6.2-bin.zip

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip

当然在build前,最好清理一下缓存。

当然原因是多种多样的,大家可以慢慢尝试。

三、 推荐阅读

Java 专栏

SQL 专栏

数据结构与算法

Android学习专栏

未经允许不得转载

ddd

猜你喜欢

转载自blog.csdn.net/fumeidonga/article/details/137607706
今日推荐