InteliJ IDEA don't recognize kotlin android extensions


#1

I’ve configured gradle to use kotlin-android-extensions and build succeeds, but IDEA don’t recognize kotlinx package, so I don’t have any code-completion with this useful features, that extensions provide. What am I doing wrong?

This is my build configuration:

App:

buildscript {
    repositories {
        jcenter()
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:${kotlinVersion}"
    }
}

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

repositories {
    jcenter()
}

android {
    compileSdkVersion 21
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "tk.saksmt.rp.app"
        minSdkVersion 21
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    packagingOptions {
        exclude 'META-INF/DEPENDENCIES'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_7
        targetCompatibility = JavaVersion.VERSION_1_7
    }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}"
    compile "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
    compile "com.fasterxml.jackson.module:jackson-module-kotlin:${jacksonKotlinVersion}"
    compile "joda-time:joda-time:${jodaTimeVersion}"
    provided "org.projectlombok:lombok:${lombokVersion}"
    compile fileTree(dir: 'libs', include: ['*.jar'])
}

Properties file:

kotlinVersion = 1.0.0-beta-4583
jacksonVersion = 2.7.0
jacksonKotlinVersion = 2.7.0-rc2
jodaTimeVersion = 2.9.1
lombokVersion = 1.16.6

Main config:

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

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'

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

allprojects {
    repositories {
        jcenter()
    }
}

And the error I have:

IDEA version: 15.0.2+IU-143-1184
Kotlin plugin version: 1.0.0-beta-2428-IJ143-18
JDK version (I doubt that it is necessary, but anyway):

java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

#2

Please either update the Kotlin plugin to the latest version (beta 4) or install the Android extensions plugin which was available as a separate plugin before beta 4.


#3

Oh, thanks! You saved a lot of my time. (For some strange reason IDEA didn’t update it to the latest version yesterday, and didn’t show messages about available update)