Не удалось выполнить задачу «:base:collectDependities»Android

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Не удалось выполнить задачу «:base:collectDependities»

Сообщение Anonymous »

Я новичок в AGP и Gradle.
Но мне нужно собрать проект, который был обновлен до AGP 8.7.3 и Gradle 8.9.
Структура проекта:

приложение

   |-base

   |     |-администратор

   |     |-сеть

   |     |-другие модули...

   |-другие модули...

После обновления при сборке проекта возникла ошибка:
> The consumer was configured to find a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3',
attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug',
attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo',
attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production',
attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard',
attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin',
attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm'.
However we cannot choose between the following variants of project :admin:
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant android-classes-jar declares a library for use during compile-time, preferably optimized for Android, as well as
attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3',
attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug',
attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo',
attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production',
attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard',
attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin',
attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'android-classes-jar' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant android-lint declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3',
attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug',
attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo',
attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production',
attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard',
attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin',
attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'android-lint' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant android-lint-local-aar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo', attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production', attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard', attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'android-lint-local-aar' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant android-manifest declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo', attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production', attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard', attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'android-manifest' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant android-renderscript declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo', attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production', attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard', attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'android-renderscript' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant android-symbol-with-package-name declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo', attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production', attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard', attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'android-symbol-with-package-name' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo', attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production', attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard', attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'jar' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Provides its elements packaged as a jar but the consumer didn't ask for it
- Configuration ':admin:productionIsoAdminIsoStandardDemoDebugApiElements' variant r-class-jar declares a library for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.7.3', attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.ProductFlavor:contentType' with value 'demo', attribute 'com.android.build.api.attributes.ProductFlavor:environment' with value 'production', attribute 'com.android.build.api.attributes.ProductFlavor:standard' with value 'isoStandard', attribute 'com.android.build.api.attributes.ProductFlavor:type' with value 'isoAdmin', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm':
- Unmatched attributes:
- Provides attribute 'artifactType' with value 'r-class-jar' but the consumer didn't ask for it
- Provides attribute 'com.android.build.gradle.internal.attributes.VariantAttr' with value 'productionIsoAdminIsoStandardDemoDebug' but the consumer didn't ask for it
- Provides attribute 'contentType' with value 'demo' but the consumer didn't ask for it
- Provides attribute 'environment' with value 'production' but the consumer didn't ask for it
- Provides attribute 'standard' with value 'isoStandard' but the consumer didn't ask for it
- Provides attribute 'type' with value 'isoAdmin' but the consumer didn't ask for it
- Provides its elements packaged as a jar but the consumer didn't ask for it

Вот административный build.gradle.
version = extra["snapshotVersion"]!!

android {
namespace = "namespace"

defaultConfig {
minSdk = 28
compileSdk = 35
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

flavorDimensions.addAll(listOf("environment", "type", "standard", "contentType"))
productFlavors {
register("demo") {
dimension = "contentType"
}

register("production") {
dimension = "environment"
}

register("isoAdmin") {
dimension = "type"
}

register("isoStandard") {
dimension = "standard"
}

register("isoDemo") {
dimension = "type"
}
}

buildTypes {
release {
isMinifyEnabled = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro",
"library.pro"
)
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

isCoreLibraryDesugaringEnabled = false
}
kotlinOptions {
jvmTarget = "17"
}

publishing {
singleVariant("productionIsoAdminIsoStandardDemoRelease")
}

privacySandbox {
enable = true
}
}

afterEvaluate {
publishing {
publications {
create("productionIsoAdminIsoStandardDemoRelease") {
artifactId = "admin"
from(components["productionIsoAdminIsoStandardDemoRelease"])
}
}
}
}

dependencies {
api(project(":person")) {
// Specify variant filtering
attributes {
attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:contentType", String::class.java),
"demo"
)
attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:environment", String::class.java),
"production"
)
attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:standard", String::class.java),
"isoStandard"
)
attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:type", String::class.java),
"isoAdmin"
)
}
}
implementation(libs.timber)
coreLibraryDesugaring(libs.android.desugar)
}

Вот базовый build.gradle.kts
plugins {
id("project.android.library")
id("project.android.library.compose")

alias(libs.plugins.android.library)

kotlin("android")
kotlin("kapt")
kotlin("plugin.serialization")

alias(libs.plugins.about.libraries)
alias(libs.plugins.ksp)
}

android {
namespace = "namespace"
version = 1

defaultConfig {

manifestPlaceholders["appName"] = "appName"

minSdk = 28
compileSdk = 35

javaCompileOptions {
annotationProcessorOptions {
arguments += mapOf(
"room.schemaLocation" to "$projectDir/schemas",
"room.incremental" to "true",
"room.expandProjection" to "true"
)
}
}
vectorDrawables {
useSupportLibrary = true
}

consumerProguardFile("proguard-consumer-rules.pro")
}

flavorDimensions.addAll(listOf("environment", "type", "standard"))

productFlavors {
create("production") {
dimension = "environment"
matchingFallbacks += listOf("defaultProduction")
}
create("iso") {
dimension = "type"
matchingFallbacks += listOf("defaultIso")
//missingDimensionStrategy("standard", "productionIsoAdminIsoStandardDemoRelease")
}

create("standard") {
dimension = "standard"
matchingFallbacks += listOf("defaultStandard")
}
}

buildFeatures {
buildConfig = true
aidl = false
renderScript = false
shaders = false
prefab = false
compose = true
}

composeOptions {
kotlinCompilerExtensionVersion = libs.versions.kotlin.get()
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
}

packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
// From coroutines
excludes += "DebugProbesKt.bin"
}
}

buildTypes {
getByName("debug") {
matchingFallbacks += listOf("release") // Fallback to release if no debug variant exists
}
getByName("release") {
isMinifyEnabled = false
}
}

lint {
abortOnError = false
}
}

moduleConfig {
module = LibraryModule.Base
}

dependencies {
implementation(libs.admin) {
attributes {
// Match specific variant based on attributes
attribute(
Attribute.of(
"com.android.build.api.attributes.ProductFlavor:contentType",
String::class.java
), "demo"
)
attribute(
Attribute.of(
"com.android.build.api.attributes.ProductFlavor:environment",
String::class.java
), "production"
)
attribute(
Attribute.of(
"com.android.build.api.attributes.ProductFlavor:type",
String::class.java
), "isoAdmin"
)
attribute(
Attribute.of(
"com.android.build.api.attributes.ProductFlavor:standard",
String::class.java
), "isoStandard"
)
attribute(
Attribute.of("com.android.build.api.attributes.AgpVersionAttr",
String::class.java
), "8.7.3"
)
attribute(
BuildTypeAttr.ATTRIBUTE,
objects.named("debug")
)
attribute(
Attribute.of("org.jetbrains.kotlin.platform.type",
String::class.java
), "androidJvm"
)

attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:contentType", String::class.java),
"demo"
)
attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:environment", String::class.java),
"production"
)
attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:standard", String::class.java),
"isoStandard"
)
attribute(
Attribute.of("com.android.build.api.attributes.ProductFlavor:type", String::class.java),
"isoAdmin"
)
}
}
implementation(libs.network)
}

kapt {
correctErrorTypes = true
}

//// Opt in to various experimental APIs
tasks.withType().configureEach {
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}


Подробнее здесь: https://stackoverflow.com/questions/793 ... pendencies
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»