Android 子module添加渠道配置异常

项目导入一个module编译出现如下错误:

复制代码
	The consumer was configured to find a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:1.0' with value 'test1', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.3.0', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'. However we cannot choose between the following variants of project :test_sdk:
	          - test1DebugRuntimeElements
	          - test2DebugRuntimeElements
	          - test3DebugRuntimeElements
	        All of them match the consumer attributes:
	          - Variant 'test1DebugRuntimeElements' capability Health:health_sdk:unspecified declares a runtime of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.3.0', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
	              - Unmatched attributes:
	                  - Doesn't say anything about com.android.build.api.attributes.ProductFlavor:1.0 (required 'test2')
	                  - Provides attribute 'com.android.build.api.attributes.ProductFlavor:default' with value 'test1' but the consumer didn't ask for it
	                  - Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'test1Debug' but the consumer didn't ask for it
	                  - Provides attribute 'default' with value 'test1' but the consumer didn't ask for it
	                  - Provides a library but the consumer didn't ask for it

检查后发现是主module和子module的flavorDimensions配置不一致导致,flavorDimensions允许你在定义多个产品风味时,将它们分组到不同的维度中。这样可以使得每个产品风味只能选择一个维度进行组合,而不会出现混乱或冲突的情况。

相关推荐
xiaozongt198935 分钟前
MasterGo + Claude Code 生成 Android 布局:完整实践指南
android
Anhty2 小时前
2026最新免费手机音频处理工具 !!
android·功能测试·ios·智能手机·音视频
2501_915909064 小时前
iOS应用从开发到上架App Store的完整发布流程与步骤指南
android·ios·小程序·https·uni-app·webview
狗凯之家源码网4 小时前
AI 步数修改提交系统源码应用场景与落地指南
android·数据库·人工智能·运动步数
ZHOUPUYU5 小时前
PHP 9.0 前瞻:下一代 PHP 会带来哪些新功能?
android·开发语言·php
JMchen5 小时前
性能优化——让Native代码飞起来
android·c++·性能优化
ao-weilai5 小时前
MySQL数据库:用户管理
数据库·mysql·adb
ZHOUPUYU5 小时前
PHP 8.2 的核心高级特性,包括只读类、类型系统增强
android·性能优化·php
ZHOUPUYU6 小时前
PHP 8.0 高级技术实战:从新特性到性能优化
android·性能优化·php
不爱说话郭德纲6 小时前
从“点点点”到一键出包:我把 uni-app x Android 离线打包做成了脚本
android·前端·uni-app