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

相关推荐
androidwork3 小时前
Android LinearLayout、FrameLayout、RelativeLayout、ConstraintLayout大混战
android·java·kotlin·androidx
每次的天空3 小时前
Android第十三次面试总结基础
android·面试·职场和发展
wu_android3 小时前
Android 相对布局管理器(RelativeLayout)
android
超级小忍4 小时前
如何配置 MySQL 允许远程连接
数据库·mysql·adb
李斯维5 小时前
循序渐进 Android Binder(二):传递自定义对象和 AIDL 回调
android·java·android studio
androidwork5 小时前
OkHttp 3.0源码解析:从设计理念到核心实现
android·java·okhttp·kotlin
像风一样自由6 小时前
【001】frida API分类 总览
android·frida
casual_clover6 小时前
Android 之 kotlin 语言学习笔记四(Android KTX)
android·学习·kotlin
移动开发者1号7 小时前
Android 大文件分块上传实战:突破表单数据限制的完整方案
android·java·kotlin
移动开发者1号8 小时前
单线程模型中消息机制解析
android·kotlin