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

后端 未结 19 893
挽巷
挽巷 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:18

    I have faced this issue recently... when I updated to Android Studio 3.1 .

    I did a few things to fix this.

    1. First I updated the Kotlin version in my app gradle file and added

      implementation "org.jetbrains.kotlin:kotlin-stdlib:1.2.31" 
      

      in my app gradle file. But this alone didn't fix it.

    2. Then uninstalled the kotlin plugin from settings, restarted Android Studio and installed it again.

    EDIT :

    This is my project gradle file

    buildscript {
       ext.kotlin_version = '1.2.31'
       repositories {
          jcenter()
          google()
        }
       dependencies {
          classpath 'com.android.tools.build:gradle:3.1.1'
          classpath 'com.google.gms:google-services:3.1.0'
          classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.31"
    
       }
     }
    
    allprojects {
       repositories {
          jcenter()
          maven { url "https://jitpack.io" }
          google()
       }
    }
    

    And this is my app gradle file

    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    
    android {
    
       compileSdkVersion 27
    
       buildToolsVersion '27.0.3'
    
       defaultConfig {
           ...
        }
    
        buildTypes {
            ...
        }
    
        sourceSets {
             main.java.srcDirs += 'src/main/kotlin'
         }
    
         kapt { generateStubs = true }
    
    
    }
    repositories {
         ...
    }
    
    
    dependencies {
        ...
        ...
        implementation "org.jetbrains.kotlin:kotlin-stdlib:1.2.31"
        ...
        ...
    
     }
    
    apply plugin: 'com.google.gms.google-services'
    

提交回复
热议问题