Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3 canary & Kotlin

Has anyone got the message "Kotlin not Configured"

I'm sure I missed something, but for the most part I downloaded it, and just had it import my existing 2.x settings. I tried a simply copy/paste from a java class to a new Kotlin file, and that's where I'm at.

Here is my current top level build.gradle

buildscript {
    repositories {
        jcenter {
            url = "http://jcenter.bintray.com/"
        }
        maven {
            url = "https://maven.google.com"
        }
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0-alpha1'

    }
}

allprojects {
    repositories {
        jcenter {
            url = "http://jcenter.bintray.com/"
        }
        maven {
            url = "https://maven.google.com"
        }
        mavenCentral()
    }
}

And then at the top of my module build file I have these two lines

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

The current error is "Plugin with id 'kotlin-android' not found"

like image 505
GR Envoy Avatar asked May 18 '17 00:05

GR Envoy


2 Answers

You're missing a Kotlin dependency in the dependencies block:

dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
like image 51
yole Avatar answered Oct 21 '22 21:10

yole


That message has appeared in previous versions of Android Studio (before v.3.0) when Kotlin library was not among class paths in the gradle script.

Probably, when importing your project that had no Kotlin, you've got overlapping with previous settings that results in the fact that Kotlin has not been found.

Try to create a project from scratch, insert your Java code and convert it into Kotlin (Code > Convert Java File to Kotlin File)

Java -> Kotlin file converter

like image 36
Andrew Avatar answered Oct 21 '22 21:10

Andrew