当前位置: 首页 > news >正文

Android 开发问题:Using dependency catalogs requires the activation of the matching feature preview.

  • 在 Android 开发中,出现如下错误信息
Using dependency catalogs requires the activation of the matching feature preview. See the documentation at https://docs.gradle.org/7.3.3/userguide/platforms.html#sub:central-declaration-of-dependencies * Try: > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. * Exception is: org.gradle.api.InvalidUserCodeException: Using dependency catalogs requires the activation of the matching feature preview. See the documentation at https://docs.gradle.org/7.3.3/userguide/platforms.html#sub:central-declaration-of-dependencies at org.gradle.internal.management.DefaultVersionCatalogBuilderContainer.create(DefaultVersionCatalogBuilderContainer.java:85) at org.gradle.internal.management.DefaultVersionCatalogBuilderContainer.create(DefaultVersionCatalogBuilderContainer.java:46) at org.gradle.api.internal.AbstractNamedDomainObjectContainer.create(AbstractNamedDomainObjectContainer.java:56) at org.gradle.configuration.BuildTreePreparingProjectsPreparer.lambda$generateDependenciesAccessorsAndAssignPluginVersions$0(BuildTreePreparingProjectsPreparer.java:82) at org.gradle.internal.management.DefaultDependencyResolutionManagement.versionCatalogs(DefaultDependencyResolutionManagement.java:134) ...
问题原因
  1. 这个错误表示,在 Gradle 7.3.3 中,依赖目录功能仍处于预览阶段,需要显式启用

  2. 依赖目录是 Gradle 的一个功能,它允许在一个中心位置定义和管理项目依赖项,然后在整个项目中引用它们,例如

[versions] agp = "8.7.3" kotlin = "1.9.24" coreKtx = "1.10.1" junit = "4.13.2" junitVersion = "1.1.5" espressoCore = "3.5.1" appcompat = "1.6.1" material = "1.10.0" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } junit = { group = "junit", name = "junit", version.ref = "junit" } androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" } androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" } androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } material = { group = "com.google.android.material", name = "material", version.ref = "material" } [plugins] android-application = { id = "com.android.application", version.ref = "agp" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
处理策略
  • settings.gradle.kts文件中显式启用
enableFeaturePreview("VERSION_CATALOGS")
http://www.jsqmd.com/news/330007/

相关文章:

  • 单片机毕设加分项目选题帮助
  • 基于扩散模型的滚动轴承故障诊断方法研究
  • 飞牛fnOS高危漏洞实战指南-从目录遍历到后门清理全流程
  • 基于生成对抗网络的小样本下轴向柱塞泵故障诊断研究
  • AI图像批量翻译软件:跨境电商商品图高效解决方案
  • 飞牛NAS实战安全分析:攻击溯源、病毒清理与防护加固指南
  • 2026中学生数学英语网课TOP3推荐!精准提分不踩坑,家长收藏
  • 2026 靠谱眼科 视力检查机构推荐指南|分龄选对不踩坑
  • 2025棕刚玉定制优质供应商排行榜,黑碳化硅/磨料/不锈钢灰/碳化硅/精密铸造砂/白刚玉/棕刚玉/铬刚玉/金刚砂棕刚玉门店有哪些
  • SpringBoot入门
  • 中学生全科网课哪家好?实测3家高口碑,数学/英语/语文提分不踩坑
  • RAG、Agent 与 MCP 详解:现代AI系统的构建基石
  • 哲学社会科学研究的五大误区与出路——对《算法黑箱问题:休谟问题的当代延续》的批判性剖析
  • Windows 下使用 Flutter 进行混合开发环境搭建
  • Meta首席科学家LeCun:当前 AI 模型缺乏四项关键人类智能特质
  • 常用运维故障排查命令
  • [solution] 关闭硬件加速解决导出视频绿屏
  • 学霸同款 10个一键生成论文工具测评:专科生毕业论文+开题报告高效写作指南
  • 猫头鹰护眼靠谱吗?验光准度+近视防控全测评,家长必看!
  • 青少年全科网校怎么选?优质网校解析+避坑指南
  • Debian 13基于kubeadm和containerd部署单节点kubernetes
  • Java线程池缓冲队列上限解析 - 指南
  • 2026年本地衬塑衬四氟管道品牌口碑趋势分析,耐磨管件/合金管道/保温管件/高压管件,工厂预制化管道公司怎么选择
  • 避坑指南|青少年语数英网校哪家好?实测3科高口碑推荐,家长闭眼冲
  • 详细介绍:农产品电商|基于SprinBoot+vue的农产品电商系统(源码+数据库+文档)
  • 计算机毕业设计springboot公交线路查询系统 基于SpringBoot的城市公交出行路线智能检索平台 SpringBoot框架下的公共交通线路信息可视化系统
  • 小学生全科网课怎么选?语数英爆款平台+免费APP硬核测评!
  • 计算机毕业设计springboot娱乐网站设计与实现 基于SpringBoot的在线影音文学社区构建 SpringBoot驱动的多媒体互动娱乐平台研发
  • oracle使用服务名链接报错ORA-12537: TNS:connection closed
  • 市场上排行前列的短视频矩阵厂商推荐,ai数字人矩阵/ai排名/矩阵/抖音短视频矩阵,短视频矩阵系统排行