Outdated Kotlin Runtime warning in Android Studio

前端 未结 15 1603
温柔的废话
温柔的废话 2020-11-29 19:43

After downloaded and installed latest Kotlin plugin I have Outdated Kotlin Runtime warning from Android Studio that telling me:

Your

相关标签:
15条回答
  • 2020-11-29 20:22

    There are two pieces you may want to update:

    1. kotlin runtime for the project
    2. kotlin plugin

    The answer by Ivo Stoyanov shows how to do this using the android studio menus. When I got the error message and tried this (updating the kotlin plugin) alone, it still complained about the kotlin runtime. You can update that on a project by project basis, by adding the line on ext.kotlin_version to the project build gradle, as some of the other answers indicate. But you'll need to know the kotlin runtime version for that. Alternatively, you can also do it through the menus, as I show here below, with the bonus that android studio shows you the available versions, and you can pick the most recent.

    And then android studio will add in the appropriate line in your project build gradle.

    0 讨论(0)
  • 2020-11-29 20:25

    the latest version of kotlin is 1.2.41 use this and syn your project.

    buildscript {
    ext.kotlin_version = '1.2.41'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    }
    
    0 讨论(0)
  • 2020-11-29 20:30

    You can update your Kotlin version in your project level build.gradle file. If you have it configured the usual way, you should have the following line in it around the top:

    ext.kotlin_version = '1.1.2'
    

    To upgrade to the version matching your plugin, simply change this line to:

    ext.kotlin_version = '1.1.2-3'
    

    Edit (to respond to a question below):

    The error tells you that you need to upgrade your version, the question is where to find out that you have to put in 1.1.2-3 instead of saying, for example, 1.1.2-release-Studio2.3-3.

    The best way to find out the latest version of Kotlin is by going to kotlinlang.org and looking for "Latest version". Should be right there on the front page.

    Another thing to do if the version number is non-trivial like this is to check the repositories where the versions are hosted. In the case of Android, you'll probably be getting it from jcenter, for which you can find the repository page, which has all the available versions listed.

    You can also browse the raw maven repository of jcenter where the files are actually hosted by going here, or look up Kotlin either on mvnrepository or on mavencentral (raw version of the latter here).

    0 讨论(0)
  • 2020-11-29 20:33

    Bit annoying but studio acts like it some times. Below steps can fix the issue.

    Go to

    Settings -> Build, Execution, Development -> Gradle -> Use default gradle wrapper(recommended)

    change this to Use local and back to Use default. Studio will ask about updating gradle after closing the settings windows.

    0 讨论(0)
  • 2020-11-29 20:33

    I had faced this issue on latest Android Studio from Canary channel. You might want to consider downgrading Android Studio to stable version as well.

    It happened for me on Android Studio 3.0 RC1.

    0 讨论(0)
  • 2020-11-29 20:34

    search for these two lines of code

    ext.kotlin_version = '1.3.11'

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    replace $kotlin_version with actual value (here it's 1.3.11)

    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.11"

    after this your IDE will automatically suggest you the updated version

    happy coding :)

    0 讨论(0)
提交回复
热议问题