I had and idea for an app for private use and just went for it. I used chat gpt to produce the code and to ‘tell’ me, where to put it in the Android Studio project. All went fine but finally I encountered the problem in the title. Chat GPT suggested all kinds of adjustments but nothing helped. I then asked it to produce a question that I could put into a forum like this one. Here comes the question/description and the code.
" I’m developing an Android app using Jetpack Compose, and I’m encountering an issue while configuring my build.gradle.kts
file.
The error message I’m getting is:
On plugin declaration 'kotlin' expected to find any of 'id' or 'version' but found unexpected keys 'android'
.
Steps I’ve tried so far:
- Updated plugins (
com.android.application
,org.jetbrains.kotlin.android
,org.jetbrains.compose
). - Upgraded Gradle version to
8.9
. - Cleared Gradle cache and re-synced the project.
Here are my configuration files:
settings.gradle.kts
:
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") // Jetpack Compose repository
}
}
rootProject.name = "Steffis App"
include(":app")
build.gradle.kts
(Module-level):
plugins {
id("com.android.application") // Android-Plugin
id("org.jetbrains.kotlin.android") // Kotlin-Plugin
id("org.jetbrains.compose") // Compose-Plugin
}
android {
namespace = "com.example.steffisapp"
compileSdk = 34
defaultConfig {
applicationId = "com.example.steffisapp"
minSdk = 21
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "11"
}
buildFeatures {
compose = true
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
// Zusätzliche Abhängigkeiten
implementation(libs.androidx.appcompat) // AppCompatActivity
implementation(libs.androidx.constraintlayout) // ConstraintLayout
implementation(libs.google.material) // Material Design Components
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
Any ideas on what might be causing this issue? Thanks in advance for your help!
Thank you in advance!
Steffi