Célia
Célia

Reputation: 93

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

I started learning Kotlin in Android studio a few days ago and I still haven't figured it all out, so having this problem is a big question mark for me, I know nothing yet about gradle. Screen of faild gradle

I just created a new empty activity and it suddenly appears out of nowhere.

this is my buildgradle file :

plugins {
id 'com.android.application' version '7.1.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false}

task clean(type: Delete) {
delete rootProject.buildDir}

Upvotes: 9

Views: 33017

Answers (10)

Ali Has
Ali Has

Reputation: 700

In your top-level (Project) build.gradle, add this line:

id 'org.jetbrains.kotlin.android' version '1.8.0' apply false

So, it will look like this:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.4.2' apply false
    id 'com.android.library' version '7.4.2' apply false
    id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

Upvotes: 0

Pawan Shukla
Pawan Shukla

Reputation: 47

There's one more reason for this problem.. In my case the VPN was blocking the Android studio for internet access. I turned off VPN and tried opening it ... It worked.

Upvotes: -1

Arun Aditya
Arun Aditya

Reputation: 1104

be care full wire 1.7.20 I was getting errors because I was writing 1.7.2 missing 0 at the end

plugins{
id "org.jetbrains.kotlin.kapt" version "1.7.20"
}

Upvotes: 1

CS Engineer
CS Engineer

Reputation: 1

Try using a the latest version, the current latest version is:

plugins{
id "org.jetbrains.kotlin.kapt" version "1.7.20"
}

Upvotes: 0

Gourav Dadhich
Gourav Dadhich

Reputation: 73

This problem occurs when there is and older version of the package (org.jetbrains.kotlin.android) so the error denotes for updating the package version .

add the following line to your PROJECT LEVEL GRADLE FILE INTO THE PLUGLINS

plugins {
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false }

NOTE : USE THIS VERSION "1.7.20" INSTEAD OF "1.6.21"

Upvotes: 6

Hari Agus W
Hari Agus W

Reputation: 91

Update your plugins to

plugins {
   ...
   id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}

Upvotes: 0

Shazada Khan
Shazada Khan

Reputation: 131

I was able to fix this by disabling offline mode of gradle and syncing.

Access the below by going to View -> Tool Windows -> Gradle

If button is off, press it twice to disable offline mode

Upvotes: 13

yunxin
yunxin

Reputation: 11

Android studio will install org.jetbrains.kotlin.android automatically. When you click "sync with Gradle Files" first time, Android studio didn`t react to it. After your second click, it did. that`s all.

I solve this problem by changing my vpn,which make Android studio can connect to google.

below for someone like me in China: 我的解决办法是,Android Studio设置里开代理(socks),这个时候你点“sync with Gradle Files”,会有弹窗,记得勾选HTTPS代理,然后就行了,等它下好就行。 (其实,不要手贱点掉HTTPS代理就不会有问题QAQ)

不勾选HTTPS代理的话,在v2rayN那里会显示rejected。

Upvotes: 1

Asgwani
Asgwani

Reputation: 389

The same thing happened to me. I just created a new project and the problem is solved.

Upvotes: 0

Célia
Célia

Reputation: 93

So the problem is now solved .... for some reason. I just want to add that I really don't understand why (in case someone wants to help me haha).

I tried to open another project, in another widow and I did exactly the same thing. I created a new empty activity to see if the problem was with my computer or the internet. But it wasn't. Everything worked perfectly well. No gradle problems. So I closed the second project, with the idea of really trying to find an answer for my main project, but suddenly it just... worked. I did NOTHING. I just opened a second project.

I really don't get it.

Upvotes: 0

Related Questions