Я пытаюсь создать этот график зависимостей:
презентация (модуль Android) -> домен (модуль Kotlin) -> данные (модуль Android)
И всякий раз, когда я делаю домен зависимым от реализации данных (projects.data), он выдает такую ошибку:
Could not determine the dependencies of task ':domain:compileJava'.
> Could not resolve all task dependencies for configuration ':domain:compileClasspath'.
> Could not resolve project :data.
Required by:
project :domain
> No matching variant of project :data was found. The consumer was configured to find a library for use during compile-time, compatible with Java 21, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'debugApiElements' declares a library for use during compile-time, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'debugRuntimeElements' declares a library for use during runtime, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'debugSourcesElements' declares a component for use during runtime, packaged as a jar, preferably optimized for Android, and its dependencies declared externally:
- Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attribute:
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'releaseApiElements' declares a library for use during compile-time, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'releaseRuntimeElements' declares a library for use during runtime, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'releaseSourcesElements' declares a component for use during runtime, packaged as a jar, preferably optimized for Android, and its dependencies declared externally:
rary, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attribute:
- Doesn't say anything about its target Java version (required compatibility with Java 21)
build.gradle домена:
plugins {
alias(libs.plugins.jetbrains.kotlin.jvm)
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType().configureEach {
kotlinOptions {
jvmTarget = "21"
}
}
dependencies {
implementation(projects.data)
}
Build.gradle данных
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.jetbrains.kotlin.android)
}
android {
namespace = "com.your.mom"
compileSdk = 34
defaultConfig {
minSdk = 28
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
jvmTarget = "21"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... ary-module
Почему библиотечный модуль Kotlin не может зависеть от библиотечного модуля Android? ⇐ Android
Форум для тех, кто программирует под Android
1720896031
Anonymous
Я пытаюсь создать этот график зависимостей:
презентация (модуль Android) -> домен (модуль Kotlin) -> данные (модуль Android)
И всякий раз, когда я делаю домен зависимым от реализации данных (projects.data), он выдает такую ошибку:
Could not determine the dependencies of task ':domain:compileJava'.
> Could not resolve all task dependencies for configuration ':domain:compileClasspath'.
> Could not resolve project :data.
Required by:
project :domain
> No matching variant of project :data was found. The consumer was configured to find a library for use during compile-time, compatible with Java 21, preferably in the form of class files, preferably optimized for standard JVMs, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm' but:
- Variant 'debugApiElements' declares a library for use during compile-time, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'debugRuntimeElements' declares a library for use during runtime, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'debugSourcesElements' declares a component for use during runtime, packaged as a jar, preferably optimized for Android, and its dependencies declared externally:
- Incompatible because this component declares documentation, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a library, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attribute:
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'releaseApiElements' declares a library for use during compile-time, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'releaseRuntimeElements' declares a library for use during runtime, preferably optimized for Android:
- Incompatible because this component declares a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' and the consumer needed a component, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attributes:
- Doesn't say anything about how its dependencies are found (required its dependencies declared externally)
- Doesn't say anything about its elements (required them preferably in the form of class files)
- Doesn't say anything about its target Java version (required compatibility with Java 21)
- Variant 'releaseSourcesElements' declares a component for use during runtime, packaged as a jar, preferably optimized for Android, and its dependencies declared externally:
rary, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm'
- Other compatible attribute:
- Doesn't say anything about its target Java version (required compatibility with Java 21)
build.gradle домена:
plugins {
alias(libs.plugins.jetbrains.kotlin.jvm)
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks.withType().configureEach {
kotlinOptions {
jvmTarget = "21"
}
}
dependencies {
implementation(projects.data)
}
Build.gradle данных
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.jetbrains.kotlin.android)
}
android {
namespace = "com.your.mom"
compileSdk = 34
defaultConfig {
minSdk = 28
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
kotlinOptions {
jvmTarget = "21"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
Подробнее здесь: [url]https://stackoverflow.com/questions/78744688/why-cant-a-kotlin-library-module-depend-on-an-android-library-module[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия