news 2026/4/15 9:32:32

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

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
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")
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/3/27 3:34:43

AI图像批量翻译软件:跨境电商商品图高效解决方案

跨境电商商家常面临多语言商品图的翻译需求,手动处理耗时耗力。AI图像批量翻译软件专为解决这一问题而开发,可自动识别图片中的文字并翻译为目标语言,同时保持原图排版和视觉效果。核心功能批量处理:支持同时上传多张图片&#xf…

作者头像 李华
网站建设 2026/4/14 10:18:38

[solution] 关闭硬件加速解决导出视频绿屏

剪映绿屏问题是硬件加速兼容性导致,禁用硬件加速编解码功能即可修复。硬件加速通过调用 GPU 的视频解码单元(如 NVDEC、Intel Quick Sync)来加速处理,但存在以下问题: 不同显卡对编码标准的支持程度不同驱动实现可能存…

作者头像 李华
网站建设 2026/3/30 6:37:11

stm32毕业论文(毕设)必过选题思路

【单片机毕业设计项目分享系列】 🔥 这里是DD学长,单片机毕业设计及享100例系列的第一篇,目的是分享高质量的毕设作品给大家。 🔥 这两年开始毕业设计和毕业答辩的要求和难度不断提升,传统的单片机项目缺少创新和亮点…

作者头像 李华
网站建设 2026/4/11 0:08:28

北大联合阿里达摩院:让AI代码生成告别“只会跑不会快“的困境

当我们打开手机App或者使用各种软件时,背后都有无数行代码在默默运转。而现在,人工智能已经能够帮助程序员写代码了——这听起来很酷,但问题是,AI写出的代码往往像一个刚学会开车的新手:能把车开到目的地,但…

作者头像 李华