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

相关推荐
HumoChen9923 分钟前
GZip+Base64压缩字符串在ios上解压报错问题解决(安卓、PC模拟器正常)
android·小程序·uniapp·base64·gzip
didiplus3 小时前
MySQL 8.0 OCP(1Z0-908)英文题库(31-40)
mysql·adb·ocp·数据库管理员·mysql认证
沙振宇4 小时前
【HarmonyOS】ArkTS开发应用的横竖屏切换
android·华为·harmonyos
橙子199110166 小时前
Kotlin 中的作用域函数
android·开发语言·kotlin
zimoyin6 小时前
Kotlin 懒初始化值
android·开发语言·kotlin
枣伊吕波7 小时前
第六节第二部分:抽象类的应用-模板方法设计模式
android·java·设计模式
萧然CS7 小时前
使用ADB命令操作Android的apk/aab包
android·adb
越甲八千8 小时前
windowsC++操作ADB
c++·windows·adb
_extraordinary_11 小时前
MySQL 事务(二)
android·数据库·mysql
鸿蒙布道师15 小时前
鸿蒙NEXT开发动画案例5
android·ios·华为·harmonyos·鸿蒙系统·arkui·huawei