23

Windows 10, Android Studio 3.0.1. Just fired it up and got the "there's a new version available, update?". I updated. Now I get "Outdated Kotlin.Runtime. Version of Kotlin runtime is outdated in several libraries" followed by a long URL.

So I need to update the Kotlin Runtime. How do I do that?

Snotnose
  • 341
  • 1
  • 2
  • 4
  • are you using gradle? then updating the version in the build script should do the trick – s1m0nw1 Jan 31 '18 at 23:03
  • 1
    90% sure I'm using gradle. Which build script, and which version? New to Android studio and kotlin, but 40 years programming experience. – Snotnose Jan 31 '18 at 23:13
  • There should be a build.gradle file in your project root, there will be a Kotlin version specified – s1m0nw1 Jan 31 '18 at 23:15
  • build.gradle had version 1.2.10, so I bumped it to 11. A.S. gave an error message mentioning 1.2.10-release-109, so I changed it to that. Still get an error. What do I change the version to? – Snotnose Jan 31 '18 at 23:22
  • Let me re-phrase that. How do I find out what version to use? – Snotnose Jan 31 '18 at 23:24
  • I’d use the latest: 1.2.21 – s1m0nw1 Jan 31 '18 at 23:25
  • Right answer turned out to be 1.1.51. Found by seeing what was in the Android Studio kotlin directory. There has to be a better way.... – Snotnose Jan 31 '18 at 23:41

4 Answers4

59

You can update and install new Kotlin plugin from Android Studio itself. See screenshot from Android Studio

Pang
  • 9,564
  • 146
  • 81
  • 122
Jose
  • 2,479
  • 1
  • 20
  • 17
8

Open the "root" build.gradle of your project. At the very beginning you should find something like this:

buildscript {
ext.kotlin_version = '1.1.51'
repositories {
    google()
    jcenter()
}

change te second line to looks like:

ext.kotlin_version = '1.2.30'

How you should know exactly to which version to update the Kotlin runtime? Easy, take a look to the Event Log in Android Studio, the Kotlin plugin will complain there: Event Log message

Gille
  • 316
  • 3
  • 4
  • I did that but it keep showing, only when open project : Outdated Kotlin Runtime Your version of Kotlin runtime in 'Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.2.0@jar' library is 1.2.0-release-90 (1.2.0), while plugin version is 1.2.30-release-Studio3.1-1. – quangkid Mar 13 '18 at 03:33
  • Try this: *./gradlew cleanBuildCache* After that it should be fixed, if you've put *ext.kotlin_version = '1.2.30"* – Gille Mar 13 '18 at 13:39
5

In latest version of android studio it is even easier:

enter image description here

Then:

enter image description here

Finally restart Android Studio.

F.Mysir
  • 2,838
  • 28
  • 39
4

After version 3 of Android Studio you don't need the Kotlin plugin, just uncheck it. The Kotlin version will look after itself, via a metadependency variable.

  • 2
    What do you mean "uncheck" it. What does your build.gradle file look like? – lostintranslation Jan 25 '19 at 17:46
  • didnt work for me - after unchecking and restarting - the compiler couldnt even start – Ohad Bitton Nov 25 '19 at 21:23
  • This corrupted my Android Studio (4.1.2) and forced reinstall from scratch :( To be fair, I was warned there were plugins dependent on it, but I thought I'd be able to just re-enable it if there was troubles. – alr3000 Aug 09 '22 at 23:47