Updated to Android Studio 3.0. Getting a “Kotlin not configured” error

后端 未结 19 801
挽巷
挽巷 2020-12-18 17:59

I just updated to Android Studio 3.0 and I\'m getting this error with an existing project:

Kotlin not configured

When I go to

相关标签:
19条回答
  • 2020-12-18 18:35

    Closing and restarting Android Studio works for me in that case. Important is that there are no other projects opened in Android Studio before you close it. I suspect that closing Android Studio with multiple opened project windows sometimes messes up the configuration especially after plugin upgrades etc.

    0 讨论(0)
  • 2020-12-18 18:35

    The only fix for me was adding

    apply plugin: 'kotlin-android-extensions'
    

    in build.gradle (:app)

    0 讨论(0)
  • 2020-12-18 18:36

    In my case I had to update Android studio from version 3.4.1. to 3.5 and it resolved the kotlin not configured error.

    0 讨论(0)
  • 2020-12-18 18:37

    Simply Create a new Activity and select its language to kotlin Android studio Automatically configured kotlin for you.

    0 讨论(0)
  • 2020-12-18 18:39

    Important Update

    You should check JDK version before setting config

    Kotlin gradle config page has detailed information about this.

    Step 1

    Check kotlin version in project level gradle file.

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

    For kotlin_version '1.2.x' Use jdk NOT jre

    Step 2

    Check JDK version in File > Project Structure

    Or check in build.gradle

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    

    If no JDK version is set in Project Structure, then choose by Android Studio version

    • JDK version is 1.7 for Android Studio Version < 2.2.1
    • JDK version is 1.8 for Android Studio Version < 2.2.1

    Because Android Studio is bundled with jdk 1.8 since 2.2.1 version.

    You have 3 options of kotlin stdlib, choose according JDK version

    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" //jdk_version == 1.8
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" //jdk_version == 1.7
    implementation"org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // jdk_version is < 1.7
    

    if kotlin version is'1.1.x' Use jre NOT jdk

    implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" // or jre8
    

    Update Kotlin Version?

    You can update Kotlin version from Tools > Kotlin > Configure Kotlin Updates

    0 讨论(0)
  • 2020-12-18 18:41

    The only thing that worked for me was to uninstall the kotlin plugin (File -> Settings -> Plugins -> Kotlin press uninstall) and after a restart of Android Studio reinstall the plugin.

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