32

Cannot build a new project using Android Studio 4.2 because of the following error:

A problem occurred configuring root project 'My Application'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
       - https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
     Required by:
         project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

When I changed the Kotlin plugin version from ext.kotlin_version = "1.5.0-release-764" to ext.kotlin_version = "1.5.0" app builds successfully but the following warning appears:

Kotlin version that is used for building with Gradle (1.5.0) differs from the one bundled into the IDE plugin (1.5.0-release-764) 

enter image description here

6
  • But I want to use the latest Kotlin version May 5, 2021 at 13:33
  • 2
    As it is not released as a stable version yet, Kotlin 1.5 should be used in Android Studio Canary instead of the latest stable version
    – Wang
    May 5, 2021 at 13:44
  • 1
    @Wang who said it's not stable? Where did you get this info?
    – user924
    May 6, 2021 at 12:20
  • I'm thinking this is a bug with the new release. Any time I got this warning, updating the version made the warning go away and I was at the latest stable version. This appears to be impossible with the new version, unless there is some missing gradle setting that is preventing it from finding the bundled version.
    – John Glen
    May 8, 2021 at 15:22

6 Answers 6

12

Change From

buildscript {
ext.kotlin_version = "1.5.0-release-764"
......}

Change To

buildscript {
ext.kotlin_version = "1.5.0"
....}

Change the Kotlin Version Issue will be cleared.

1
  • I'm already mentioned that in the question but what about the warning!? May 19, 2021 at 19:38
6

This is a known bug:

https://youtrack.jetbrains.com/issue/KTIJ-11590

"the problem will be fixed in 1.5.10 update"

3

I went to the build.gradle file and changed the ext.kotlin_version = "1.5.0" to ext.kotlin_version = "1.4.32", as that was the version of an older project which successfully built.

2
  • Again I want to use the latest stable version of Kotlin which is 1.5.0 Also, If I used this 1.4.32 warning still exists. May 9, 2021 at 19:51
  • 1
    Well apparently 1.4.32 is the latest stable version lol 1.5.0 doesn't seem to be working right May 10, 2021 at 20:02
2

I was using the same version of kotlin-gradle-plugin bundled with the IDE, which is 1.5.10, in Android studio 4.2.1, and for me disabling the 'Block connections to untrusted servers' in my anti-virus fixed the error.

0

According to Android Studio's message, Kotlin's latest stable version is 1.5.0-release-764. If you want to (or in this case I guess everyone needs to) use version 1.5.0:

  1. Go to Tools in the menu

  2. Go to Kotlin

  3. Choose Configure Kotlin Plugin Updates

  4. In the drop-down, choose the early access preview version of 1.5.x and then click OK.

Gradle sync will now configure the Studio with Kotlin 1.5.0.

enter image description here

1
  • This doesn't fix the warning May 8, 2021 at 11:07
0

if you work on flutter project ,you just need to update flutter sdk run that command in terminal:

flutter upgrade

After updating , new flutter version will fix that errors automatically.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.