IDE Syntax Analysis Error w/Kotlin 1.3.11 plugin and Android Studio 3.2.1


#1

Hello

I’m currently using Android Studio 3.2.1 with the Kotlin 1.3.11 plugin. As of today certain Kotlin keywords are no longer recognized by the IDE syntax analyzer as being valid Kotlin see screenshot below:

If I change the version of Kotlin in my project build.gradle to 1.3.10 the syntax error above goes away and all is fine.

To demonstrate the error I created the above project from scratch using the new project wizard and I didn’t make any changes to the default build.gradle files.

project:

buildscript {
    ext.kotlin_version = '1.3.11'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        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
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

module (app):

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.dllopis.hellokterror"
        minSdkVersion 26
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Everything was working fine on Friday (12/14). This error appeared this morning (12/17).

Here is my Android Studio profile:

Android Studio 3.2.1
Build #AI-181.5540.7.32.5056338, built on October 8, 2018
JRE: 1.8.0_152-release-1136-b06 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

Please advise.

thanks!


#2

Hello. This morning things got worse. I could no longer import kotlin stdlib imports into my projects. I forgot to mention that I had upgraded Android Studio in place to 3.2. I was unable to figure out what is causing the syntax analyzer to fail. I uninstalled Android Studio (and all of the supporting directories and files). I then installed a fresh copy of Android Studio and now everything (syntax analysis, imports, etc.) works again. Hope this helps anyone in a similar situation.