Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile with custom buildType #269

Open
axrkozlov opened this issue Apr 1, 2021 · 6 comments
Open

Cannot compile with custom buildType #269

axrkozlov opened this issue Apr 1, 2021 · 6 comments

Comments

@axrkozlov
Copy link

axrkozlov commented Apr 1, 2021

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 axrkozlov changed the title Not compile with custom buildType Cannot compile with custom buildType Apr 1, 2021
@LouisCAD
Copy link
Owner

LouisCAD commented Apr 1, 2021

Hi, you need to use matchingFallbacks.

@felixdivo
Copy link

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

@mgray88
Copy link

mgray88 commented Sep 3, 2021

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

@zuinqstudio
Copy link

@LouisCAD @felixdivo Could you please elaborate a bit on the solution?

@felixdivo
Copy link

@LouisCAD @felixdivo Could you please elaborate a bit on the solution?

Not really, TBH. I don't really remember this issue or how to solve it. Sorry.

@LouisCAD
Copy link
Owner

LouisCAD commented Sep 3, 2024

My next hint is to Google the hint I gave earlier, @zuinqstudio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants