Ich versuche, ein benutzerdefiniertes Gradle -Plugin für mein App -Modul in einem Kotlin -Multiplattform -Projekt zu implementieren, aber ich habe diesen Fehler aufgenommen, wenn ich mein benutzerdefiniertes Plugin- und Synchronisierungsprojekt anwende.
> Configure project :app
mmd is Coming
com.android.application
e: Please initialize at least one Kotlin target in 'app (:app)'.
Read more https://kotl.in/set-up-targets
w: The following Kotlin source sets were configured but not added to any Kotlin compilation:
* commonMain
* commonTest
You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'.
See https://kotl.in/connecting-source-sets
w: Missing 'androidTarget()' Kotlin target in multiplatform project 'app (:app)'.
The Android Gradle plugin was applied without creating a corresponding 'android()' Kotlin Target:
plugins {
id("com.android.application")
kotlin("multiplatform")
}
kotlin {
androidTarget() // \ com.android.build.api.dsl.ApplicationExtension
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
* Exception is:
java.lang.NoClassDefFoundError: com/android/build/api/dsl/ApplicationExtension
at ApplicationGradlePlugin.apply(ApplicationGradlePlugin.kt:24)
...
Caused by: java.lang.ClassNotFoundException: com.android.build.api.dsl.ApplicationExtension
at org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader.findClass(VisitableURLClassLoader.java:187)
... 215 more
CONFIGURE FAILED in 6s
Ich versuche, ein benutzerdefiniertes Gradle -Plugin für mein App -Modul in einem Kotlin -Multiplattform -Projekt zu implementieren, aber ich habe diesen Fehler aufgenommen, wenn ich mein benutzerdefiniertes Plugin- und Synchronisierungsprojekt anwende.[code]> Configure project :app mmd is Coming com.android.application e: Please initialize at least one Kotlin target in 'app (:app)'. Read more https://kotl.in/set-up-targets
w: The following Kotlin source sets were configured but not added to any Kotlin compilation: * commonMain * commonTest You can add a source set to a target's compilation by connecting it with the compilation's default source set using 'dependsOn'. See https://kotl.in/connecting-source-sets
w: Missing 'androidTarget()' Kotlin target in multiplatform project 'app (:app)'. The Android Gradle plugin was applied without creating a corresponding 'android()' Kotlin Target:
> Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org.
* Exception is: java.lang.NoClassDefFoundError: com/android/build/api/dsl/ApplicationExtension at ApplicationGradlePlugin.apply(ApplicationGradlePlugin.kt:24) ... Caused by: java.lang.ClassNotFoundException: com.android.build.api.dsl.ApplicationExtension at org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader.findClass(VisitableURLClassLoader.java:187) ... 215 more
CONFIGURE FAILED in 6s [/code] [b] Mein benutzerdefiniertes Plugin in Buildsrc: [/b] [code]class ApplicationGradlePlugin : Plugin { override fun apply(target: Project) { with(target) { val libs = extensions.getByType().named("libs")
println("mmd is Coming") println(libs.findPlugin("androidApplication").get().get().pluginId) pluginManager.apply(libs.findPlugin("kotlinMultiplatform").get().get().pluginId)
println("mmd done his job..") } } } < /code> Build.gradle.KTS -Datei im App -Modul: < /p> import org.jetbrains.compose.desktop.application.dsl.TargetFormat
plugins { alias(libs.plugins.kotlinMultiplatform) alias(libs.plugins.composeMultiplatform) alias(libs.plugins.composeCompiler) alias(libs.plugins.kotlin.serialization) alias(libs.plugins.androidApplication) id("com.sample.myproject.application-plugin")// --> this is my custom plugin }
defaultConfig { applicationId = "com.sample.myproject" // other configurations } < /code> Ich habe mein Plugin geleert und Konfigurationen Schritt für Schritt hinzugefügt und jedes Mal synchronisiert, da ich dies füge: < /p> extensions.getByType(ApplicationExtension::class.java) < /code> Es gibt mir den Fehler.extensions.getByType(KotlinMultiplatformExtension::class).apply { androidTarget() jvm("desktop") } [/code] , aber es hat keinen Unterschied gemacht.
Warum-Sync und --no-sync im DF-Befehl in Linux, gibt mir die gleiche Ausgabe? Dieser df-no-sync und dann habe ich das df-sync flagge ausgeführt, aber beide geben mir die gleiche Ausgabe. Also habe...
Ich lade Android Studio 2024.2.1 Patch 1 herunter, installiere es
, erstelle ein neues leeres Projekt, nachdem die Synchronisierung gestartet wurde, aber ich habe diesen Fehler erhalten:
Build file...