Kotlin not configured


#1

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.


#2

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


#3

Thanks for reply! The project I did clone is on github. Do you mean this line https://github.com/sreich/ore-infinium/blob/master/build.gradle#L274. If so it seems so.


#4

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.


#5

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


#6

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.


#7

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.


#8

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


#9

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.


#10

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


#11

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


#12

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”
}
}


#13

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?


#14

What kind of project do you have?


#15

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


#16

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’.


#17

Try File | Invalidate Caches


#18

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: