Splitties icon indicating copy to clipboard operation
Splitties copied to clipboard

Cannot compile with custom buildType

Open axrkozlov opened this issue 4 years ago • 6 comments

Hi! I have buildType named 'dev' and can't compile my project with splitters library com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01.

StackTrace: Execution failed for task ':app:dataBindingMergeDependencyArtifactsDev'.

Could not resolve all files for configuration ':app:devCompileClasspath'. Could not resolve com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01. Required by: project :app > No matching variant of com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01 was found. The consumer was configured to find an API of a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'dev', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but: - Variant 'android-debugApiElements' capability com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01 declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm': - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'dev' - Variant 'android-debugRuntimeElements' capability com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01 declares a runtime of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm': - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'dev' - Variant 'android-releaseApiElements' capability com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01 declares an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm': - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'dev' - Variant 'android-releaseRuntimeElements' capability com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01 declares a runtime of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm': - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'dev' - Variant 'metadata-api' capability com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01: - Incompatible because this component declares a usage of 'kotlin-metadata' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' - Other compatible attribute: - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'dev') - Variant 'metadata-commonMainMetadataElements' capability com.louiscad.splitties:splitties-fun-pack-android-base:3.0.0-beta01: - Incompatible because this component declares a usage of 'kotlin-api' of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'common' and the consumer needed an API of a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' - Other compatible attribute: - Doesn't say anything about com.android.build.api.attributes.BuildTypeAttr (required 'dev')

With debug and release types the project is compiling.

axrkozlov avatar Apr 01 '21 11:04 axrkozlov

Hi, you need to use matchingFallbacks.

LouisCAD avatar Apr 01 '21 21:04 LouisCAD

@LouisCAD Thank's a lot! I was really puzzled by the error messages. Thank's for this hint!

felixdivo avatar May 21 '21 07:05 felixdivo

In case anyone else finds this issue, here is the actual documentation: https://developer.android.com/studio/build/dependencies#variant_aware

mgray88 avatar Sep 03 '21 12:09 mgray88