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允许你在定义多个产品风味时,将它们分组到不同的维度中。这样可以使得每个产品风味只能选择一个维度进行组合,而不会出现混乱或冲突的情况。

相关推荐
一航jason7 小时前
Android平台推理框架及试用场景模型对比
android·人工智能·ai·架构·ai编程·llama
一航jason7 小时前
Android 端侧大模型推理框架对比
android·人工智能·ai·ai编程·llama·ai-native
新时代牛马7 小时前
cyclictest 毛刺从哪来?从ftrace、latencytop、perf到IRQ/调度延迟定位
android·开发语言·python·kotlin
光电的一只菜鸡9 小时前
为什么调整LSC会对AF产生影响
android·开发语言·kotlin
凛_Lin~~9 小时前
LiveData 源码解析
android·安卓·livedata
hai_android10 小时前
FusibleFlow:Kotlin Flow 的融合机制原理
android·kotlin
龚寿生10 小时前
23-敏捷开发实战:从Scrum到看板的团队协作方法论
android·学习·scrum·敏捷流程
zhangguojia711 小时前
Activity启动流程(四):从setContentView到View树创建与Window挂载
android
三少爷的鞋14 小时前
Kotlin 2026:裁员、AI、Rust——黄金时代结束了吗?Jake Wharton 为你解答
android