Android Studio 构建失败: 无法解析依赖项和配置错误
'FAILURE: Build failed with an exception.
- What went wrong: Could not resolve all files for configuration 'classpath'.
 
Could not resolve com.itsaky.androidide:gradle-plugin:2.5.0-beta. Required by: unspecified:unspecified:unspecified No cached version of com.itsaky.androidide:gradle-plugin:2.5.0-beta available for offline mode. No cached version of com.itsaky.androidide:gradle-plugin:2.5.0-beta available for offline mode.
- Try:
 
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.
- Get more help at https://help.gradle.org
 
CONFIGURE FAILED in 52sThe configuration :app:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. WARNING: The option setting 'android.aapt2FromMavenOverride=/data/data/com.itsaky.androidide/files/home/.androidide/aapt2' is experimental. Using default execution profile Build cache key for Kotlin DSL accessors for project ':app' is 47dfbd4e614d09a875697b8a50092204 Skipping Kotlin DSL accessors for project ':app' as it is up-to-date. Parsed shrinker version: 8.0.35 All projects evaluated. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :app:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :app:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :app:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :app:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :app:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :app:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :app:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :app:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. The configuration :app:classpath is both resolvable and consumable. This is considered a legacy configuration and it will eventually only be possible to be one of these. The configuration :app:classpath is both consumable and declarable. This combination is incorrect, only one of these flags should be set. Task name matched 'assembleDebug' Selected primary task 'assembleDebug' from project :
FAILURE: Build failed with an exception.
- What went wrong: Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
 
Could not determine the dependencies of null. Failed to find Build Tools revision 33.0.3
- Try:
 
Run with --stacktrace option to get the stack trace. Run with --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 1s
怎么办'
根据错误信息,出现了以下问题:
- 
无法解析'com.itsaky.androidide:gradle-plugin:2.5.0-beta' 的文件,可能是因为离线模式下没有缓存版本。尝试运行
--stacktrace和--debug选项来获取更多的日志输出,并且运行--scan选项来获取完整的信息。 - 
配置
classpath同时设置了'consumable'和'declarable'属性,这是不正确的。只能设置其中之一。 - 
配置
classpath同时设置了'resolvable'和'consumable'属性,这是不正确的。只能设置其中之一。 - 
配置
app:classpath同时设置了'resolvable'和'consumable'属性,这是不正确的。只能设置其中之一。 - 
无法确定任务':app:compileDebugJavaWithJavac'的依赖关系,可能是因为找不到Build Tools版本为33.0.3的文件。
 
解决方法:
- 
检查网络连接是否正常,确保能够访问到'com.itsaky.androidide:gradle-plugin:2.5.0-beta' 的文件。
 - 
在项目的'build.gradle'文件中,查找并删除重复设置了'consumable'和'declarable'属性的地方。
 - 
在项目的'build.gradle'文件中,查找并删除重复设置了'resolvable'和'consumable'属性的地方。
 - 
在项目的'build.gradle'文件中,查找并删除重复设置了'resolvable'和'consumable'属性的地方。
 - 
确保已经安装了Build Tools版本为33.0.3的文件。如果没有安装,可以通过Android Studio的SDK Manager来安装。
 - 
如果仍然无法解决问题,尝试清除Gradle缓存。可以通过删除
<用户目录>/.gradle/caches文件夹来清除缓存。 
如果问题仍然存在,请尝试提供更多的错误信息或日志以便更好地帮助解决问题
原文地址: https://www.cveoy.top/t/topic/qE6T 著作权归作者所有。请勿转载和采集!