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

Michael
  • 57,169
  • 9
  • 80
  • 125
Ibrahim Disouki
  • 2,642
  • 4
  • 21
  • 52
  • https://stackoverflow.com/questions/67400029/cant-new-project-kotlin-after-update-android-studio-4-2/67400706#67400706 – Ananiya Jemberu May 05 '21 at 13:05
  • But I want to use the latest `Kotlin` version – Ibrahim Disouki May 05 '21 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 05 '21 at 13:44
  • 1
    @Wang who said it's not stable? Where did you get this info? – user924 May 06 '21 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 08 '21 at 15:22
  • @Wang it is already stable as it moves away from RC to release. – Bitwise DEVS May 12 '21 at 12:53

6 Answers6

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.

sangavi
  • 441
  • 1
  • 3
  • 13
6

This is a known bug:

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

"the problem will be fixed in 1.5.10 update"

John Glen
  • 771
  • 7
  • 24
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.

roflcopter1101
  • 283
  • 1
  • 6
  • 20
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.

Asdinesh
  • 183
  • 1
  • 6
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

Aman Kumar
  • 294
  • 8
  • 20
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.

  • This does not provide an answer to the question. Once you have sufficient [reputation](https://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](https://stackoverflow.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](https://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/late-answers/31052936) – SL ART Feb 17 '22 at 17:50