russhwolf
01/17/2019, 4:17 AM./gradlew clean build check publishToMavenLocal
in root directory
2. run ./gradlew clean build check
in app
directory
If the library used publishAllLibraryVariants()
this works fine, but if I do publishLibraryVariants("release")
I get an error because the debug app build can’t figure out which library variant to use.russhwolf
01/17/2019, 4:18 AM> Task :app:checkDebugClasspath FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.example:AndroidLibraryDemo:0.0.1.
Required by:
project :app
> Unable to find a matching configuration of com.example:AndroidLibraryDemo:0.0.1:
- Configuration 'android-releaseApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
- Configuration 'android-releaseRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Found com.android.build.api.attributes.VariantAttr 'release' but wasn't required.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found incompatible value 'java-runtime'.
- Required org.jetbrains.kotlin.platform.type 'androidJvm' and found compatible value 'androidJvm'.
- Configuration 'metadata-api':
- Found artifactType 'jar' but wasn't required.
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' but no value provided.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' but no value provided.
- Found org.gradle.status 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found incompatible value 'kotlin-api'.
- Required org.jetbrains.kotlin.platform.type 'androidJvm' and found incompatible value 'common'.
h0tk3y
01/17/2019, 11:04 AMh0tk3y
01/17/2019, 11:05 AMh0tk3y
01/17/2019, 11:06 AMstaging
) to fail to consume a release variant if the latter is published with the attribute.russhwolf
01/17/2019, 12:28 PMh0tk3y
01/17/2019, 12:32 PMmatchingFallbacks = ['release']
to the debug variant. However, I don't think it's good UX, so I'll still try to find out whether the release variant may be used as a default one.h0tk3y
01/17/2019, 12:37 PMandroid {
buildTypes {
debug {
matchingFallbacks = ['release']
}
}
}
h0tk3y
01/17/2019, 12:38 PMrusshwolf
01/17/2019, 12:53 PMmatchingFallbacks = ['release']
by default if the developer doesn't provide anything there.