kosmas
kosmas

Reputation: 31

Plugin [id: 'org.jetbrains.kotlin.android', version: '1.9.0', apply: false] was not found in any of the following sources:

I just installing android studio with the latest update, but gradle sync failed.

` Plugin [id: 'org.jetbrains.kotlin.android', version: '1.9.0', apply: false] was not found in any of the following sources:

attached screencapture for reference here : build.gradle + setting.gradle

Upvotes: 3

Views: 4614

Answers (3)

Ramón Telleria
Ramón Telleria

Reputation: 11

I found the solution that worked for me to solve the error: "Plugin [id: 'org.jetbrains.kotlin.plugin.compose', version: '1.9.0', apply: false] was not found in any of the following sources:"

In libs.versions.toml, delete the line "kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }" and in build.gradle.kts (Project), delete the line "alias(libs.plugins.kotlin.compose)"

Upvotes: 1

Irencent Homel
Irencent Homel

Reputation: 1

I have encountered the same problem as yours. But note that it was when I was starting a new project so my answer could be for reference only.I fixed it after below few processes:

  1. I deleted the Android studio and re-installed it.

  2. It seems that the problem has something to my proxy setting. I set the HTTP proxy as below (I take my local network and note that I use a VPN service), the host name and port number can be got from your network details:

my proxy setting

  1. The results turn out that agp = "8.6.0" was updated to be agp = "8.7.3", and kotlin = "1.9.0" was updated to be kotlin = "2.0.0"

  2. The resulting project-level build.gradle.kts file is:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        alias(libs.plugins.android.application) apply false
        alias(libs.plugins.kotlin.android) apply false
        alias(libs.plugins.kotlin.compose) apply false
    }
  1. The resulting libs.versions.toml file is:
    [versions]
    agp = "8.7.3"
    kotlin = "2.0.0"
    coreKtx = "1.10.1"
    junit = "4.13.2"
    junitVersion = "1.1.5"
    espressoCore = "3.5.1"
    lifecycleRuntimeKtx = "2.6.1"
    activityCompose = "1.8.0"
    composeBom = "2024.04.01"
    
    [libraries]
    androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
    junit = { group = "junit", name = "junit", version.ref = "junit" }
    androidx-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
    androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
    androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
    androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
    androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
    androidx-ui = { group = "androidx.compose.ui", name = "ui" }
    androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
    androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
    androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
    androidx-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
    androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4" }
    androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
    
    [plugins]
    android-application = { id = "com.android.application", version.ref = "agp" }
    kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
    kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

Upvotes: 0

szikidani
szikidani

Reputation: 11

The Compose plugin is likely not available for Kotlin version 1.9.0. The Compose plugin is available from Kotlin version 2.0.0 onwards.

Solution: Update the Kotlin version to 2.0.0 or higher in the build.gradle.kts file and make sure that the Compose plugin version matches the Kotlin version.

I just faced the same issue. This is what helped me solve the problem.

Upvotes: 1

Related Questions