Многоплатформная библиотека Kotlin с Compose Elements UI, используемые в AndroidmainAndroid

Форум для тех, кто программирует под Android
Ответить Пред. темаСлед. тема
Anonymous
 Многоплатформная библиотека Kotlin с Compose Elements UI, используемые в Androidmain

Сообщение Anonymous »

Мне интересно, можно ли создать библиотеку мультиплатформы Kotlin, которая содержит композицию, расположенную на SRC Androidmain. Со следующей build.gradle.kts (почти по умолчанию) я получаю эту ошибку: < /p>
build.gradle.kts:

Код: Выделить всё

    plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidKotlinMultiplatformLibrary)
alias(libs.plugins.composeCompiler)
alias(libs.plugins.kotlinx.serialization)
}

kotlin {

// Target declarations - add or remove as needed below. These define
// which platforms this KMP module supports.
// See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
androidLibrary {
namespace = "com.grumpyshoe.poc.feature.feature_dashboard"
compileSdk = 35
minSdk = 26

withHostTestBuilder {
}

withDeviceTestBuilder {
sourceSetTreeName = "test"
}.configure {
instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}

// For iOS targets, this is also where you should
// configure native binary output. For more information, see:
// https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks

// A step-by-step guide on how to include this library in an XCode
// project can be found here:
// https://developer.android.com/kotlin/multiplatform/migrate

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
baseName = "feature_dashboardKit"
isStatic = true
}
}

// Source set declarations.
// Declaring a target automatically creates a source set with the same name. By default, the
// Kotlin Gradle Plugin creates additional source sets that depend on each other, since it is
// common to share sources between related targets.
// See: https://kotlinlang.org/docs/multiplatform-hierarchy.html
sourceSets {
commonMain {
dependencies {
implementation(libs.kotlin.stdlib)
// Add KMP dependencies here
}
}

commonTest {
dependencies {
implementation(libs.kotlin.test)
}
}

androidMain {
dependencies {

implementation(platform(libs.compose.bom))
implementation(libs.compose.compiler)
implementation(libs.compose.ui)
implementation(libs.compose.ui.tooling)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.compose.material3)
implementation(libs.compose.runtime)
implementation(libs.compose.navigation)
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.kotlinx.serialization.json)
// Add Android-specific dependencies here. Note that this source set depends on
// commonMain by default and will correctly pull the Android artifacts of any KMP
// dependencies declared in commonMain.
}
}

getByName("androidDeviceTest") {
dependencies {
implementation(libs.compose.compiler)
implementation(libs.compose.runtime)
implementation(libs.compose.navigation)
implementation(libs.androidx.runner)
implementation(libs.androidx.core)
implementation(libs.androidx.test.junit)
}
}

iosMain {
dependencies {
// Add iOS-specific dependencies here. This a source set created by Kotlin Gradle
// Plugin (KGP) that each specific iOS target (e.g., iosX64) depends on as
// part of KMP’s default source set hierarchy.  Note that this source set depends
// on common by default and will correctly pull the iOS artifacts of any
// KMP dependencies declared in commonMain.
}
}
}

}
< /code>
 Ошибка: < /h1>
    Cannot convert the provided notation to an object of type Dependency:
map(valueof(DependencyValueSource)).
The following types/formats are supported:
- String or CharSequence values, for example 'org.gradle:gradle-core:1.0'.
- Maps, for example [group: 'org.gradle', name: 'gradle-core', version: '1.0'].
- FileCollections, for example files('some.jar', 'someOther.jar').
- Projects, for example project(':some:project:path').
- ClassPathNotation, for example gradleApi().
Я не мог найти ничего в соответствии с такой настройкой, поэтому я подумал, что в этом сообществе кто -то может узнать больше об этом.

Подробнее здесь: https://stackoverflow.com/questions/794 ... ndroidmain
Реклама
Ответить Пред. темаСлед. тема

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

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

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

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

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

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