Kotlin not configured

Hi, first of all I’m new to kotlin and have little experience with Android Studio.

I’ve Android studio 2.3.1 and installed with kotlin plugin version 1.1.2-release-Studio-2.3-3.

I keep getting Kotlin not configured at the startup every time I re-open Android Studio. I noticed gradle automatically sync thus build the project every time. I believe that action causes Kotlin syntax sensing to be failed, and showed up with Kotin not configured error. This also forces me to manually click on sync gradle button to make the popup message disappears, and kotlin syntax sensing back to normal so no more reference error, and I can start coding.

I configured build.gradle with kotlinVersion = '1.1.2', and double checked that I have apply plugin: "kotlin" for top level and sub-project’ build.gradle file.

Any help would be appreciated.

1 Like

Have you added the standard library to your dependencies? If you didn’t you will get the error in intellij and android studio.

2 Likes

Thanks for reply! The project I did clone is on github. Do you mean this line ore-infinium/build.gradle at master · sreich/ore-infinium · GitHub. If so it seems so.

I’ve tested with 3 different projects, and only 1 of them which uses gradle version 3.x experiences the problem, other twos didn’t have such problem, and it’s pretty smooth. I think I move on from my own question for now. Thanks for your help by the way.

Change apply plugin “kotlin” in Project gradle file to apply plugin: “org.jetbrains.kotlin.jvm” as shown in this link

https://plugins.gradle.org/plugin/org.jetbrains.kotlin.jvm

Please don’t give incorrect advice. The qualified name should be used in the “plugins” block. The “apply plugin” uses “kotlin”. See http://kotlinlang.org/docs/reference/using-gradle.html#targeting-the-jvm for documentation.

Can the documentation about using the plugins block be removed, or changed to actively discourage using that block? It does not prevent the “Kotlin not configured” message, and the plugin version is older than the current Kotlin version (see the Gradle plug-in page).

@nyagenox was simply following the instructions on the page of the official Gradle plug-in, and now you are saying he is giving the wrong advice. Maybe that page needs to be updated so users are directed to the correct instructions.

1 Like

I also Got the same issue . Kotlin not configured and No configured available

gradle : -
buildscript {
ext.kotlin_version = ‘1.1.4-2’
repositories {
jcenter()
}
dependencies {
classpath ‘com.android.tools.build:gradle:2.3.3’
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.7”

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

}

apply plugin: ‘kotlin’
allprojects {
repositories {
jcenter()
}
}
/task clean(type: Delete) {
delete rootProject.buildDir
}
/
repositories {
mavenCentral()
}
dependencies {
compile “org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version”
}
compileKotlin {
kotlinOptions {
jvmTarget = “1.8”
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = “1.8”
}
}

gradle:app:-

apply plugin: ‘com.android.application’
apply plugin: ‘kotlin-android’

android {
compileSdkVersion 25
buildToolsVersion “26.0.1”
defaultConfig {
applicationId “com.example.aksin.kotlincalculator”
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName “1.0”
testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner”
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘proguard-rules.pro’
}
}
}

dependencies {
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
androidTestCompile(‘com.android.support.test.espresso:espresso-core:2.2.2’, {
exclude group: ‘com.android.support’, module: ‘support-annotations’
})
compile ‘com.android.support:appcompat-v7:25.3.1’
compile ‘com.android.support.constraint:constraint-layout:1.0.2’
testCompile ‘junit:junit:4.12’
}

plz help anyone I am new to kotlin

1 Like

This line, try to change to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion".
Possible problem is version mismatch to $kotlinVersion as you set it to be 1.1.4-2.

Error:Could not find com.android.tools.build:gradle:3.0.0-alpha4.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
Required by:
project :

Error after adding that

Error:(30, 0) Gradle DSL method not found: ‘classpath()’
Possible causes:

  • The project ‘KotlinCalculator’ may be using a version of Gradle that does not contain the method.
    Open Gradle wrapper file
  • The build file may be missing a Gradle plugin.
    Apply Gradle plugin
  • this error comes out

Sir skip all

Error:(23, 0) Declaring custom ‘clean’ task when using the standard Gradle lifecycle plugins is not allowed.
Open File

Check this Error only

gradle:Build : - file

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = ‘1.1.4-2’
repositories {
jcenter()
maven { url ‘https://maven.google.com’ }
}
dependencies {
classpath ‘com.android.tools.build:gradle:3.0.0-alpha4’
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
}
}

apply plugin: ‘kotlin’
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
repositories {
mavenCentral()
}
dependencies {
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
}
compileKotlin {
kotlinOptions {
jvmTarget = “1.8”
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = “1.8”
}
}

It;s 10th october and I still somehow jumped into that issue. Now 3rd hour trying to solve ‘Kotlin not configured’ → ‘There aren’t configurators available’. Googlin is not helping, just stucked. It’s so frustrating trying to code something and fighting with such a ridicoulus issues.
I am pissed off
And just noticed, that post has nearly 5000 VIEWS !!! I highly doubt that some people are coming here just to read gradle issues in their free time. So notice, how many people it affects, maybe it’s serious and needs little improvement?

1 Like

What kind of project do you have?

Gradle, Android Studio 3, Interestingly it happens after sudden shutdown of my PC. But I imported project from Github as previously and now it’s shouting all the errors. I mean every Android class cannot be resolved etc.
it happens for newly generated project too

debug with --info, (skipped some things going well) :
Executing task ‘:app:compileDebugKotlin’ (up-to-date check took 0.013 secs) due to:
Task.upToDateWhen is false.
All input files are considered out-of-date for incremental task ‘:app:compileDebugKotlin’.
file or directory ‘D:\AppTimer\app\src\main\kotlin’, not found
file or directory ‘D:\AppTimer\app\src\debug\kotlin’, not found
file or directory ‘D:\AppTimer\app\src\main\kotlin’, not found
file or directory ‘D:\AppTimer\app\src\debug\kotlin’, not found
file or directory ‘D:\AppTimer\app\libs’, not found
file or directory ‘D:\AppTimer\app\libs’, not found
Using kotlin incremental compilation
[KOTLIN] deleting D:\AppTimer\app\build\tmp\kotlin-classes\debug on error
[KOTLIN] deleting D:\AppTimer\app\build\tmp\kotlin-classes\debug on error

:app:compileDebugKotlin (Thread[Task worker for ‘:’ Thread 2,5,main]) completed. Took 3.28 secs.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ‘:app:compileDebugKotlin’.

Compilation error. See log for more details

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 13s
14 actionable tasks: 14 executed

And with stacktrace:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:app:compileDebugKotlin’.

Try File | Invalidate Caches

5 Likes

Works now, worth pointing out that I had previously got rid of message when rechecking my ext.kotlin_version in gradle to be the same like the version of kotlin in android studio, however, unresolved stayed until applying @yole advice. Thanks again ! :slight_smile:

I’ve also had this issue in IntelliJ, twice now.

When I started my project a couple months ago it required me to update my Gradle version (I had version 4.10.2). So I updated it to v6.0.1 (didn’t delete the older version, though I don’t think that this matters). The need for the update was related to Kotlin.

At some point I started working with AndroidStudio every now and then. One time, when I opened my IntelliJ project I got that “Kotlin not configured” issue. I restarted IntelliJ, restarted my computer, and basically tried out various things to get it to run again. Don’t remember how exactly I managed to do so, but it eventually worked.

Now the exact same thing happened again. Last couple of days I was working with AS, and today after opening my IntelliJ project that “Kotlin not configured” message popped up.

It doesn’t always happen (i.e., after using AS), but I’m fairly certain it is related. My AS uses Gradle v5.1.1, so my assumption is that somehow some (Gradle) settings were changed which affected my IntelliJ project. No idea how much truth there is to this, though.

Anyway, I ran my project from the console (gradlew -run) and got the following output

Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
Download https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.3.11/kotlin-reflect-1.3.11.jar
Download https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.3.11/kotlin-stdlib-1.3.11.jar
Download https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-common/1.3.11/kotlin-stdlib-common-1.3.11.jar

Task :discoverMainScriptsExtensions
Download https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.3.11/kotlin-stdlib-jdk7-1.3.11.jar
Download https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.3.11/kotlin-stdlib-jdk8-1.3.11.jar

which resolved the issue for me.

I didn’t quite try to replicate this issue, but I hope this is of some help to others.

I’ve got here too. After selecting dependency → analyze → Analyze Module Dependencies.