AndroidStudio/Kotlin - 未解决的参考:ReadWriteProperty - Kotlin 版本 1.0.0-beta-1038

AndroidStudio/Kotlin - Unresolved reference: ReadWriteProperty - Kotlin version 1.0.0-beta-1038

我在 Android Studio 中有一个使用 Kotlin 版本 1.0.0-beta-1038 的工作 Android 项目。

我可以 运行 它在不同部分使用 Kotlin,它在模拟器中编译和工作,但是当我尝试使用 ReadWriteProperty 时它给出了这个错误消息:

未解决的引用:ReadWriteProperty

Class 调用 PreferenceUtils.kt:

build.grade(模块:应用)

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

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.droidcba.oculto"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.1'

    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

    compile 'com.squareup.retrofit:retrofit:2.0.0-beta1'
    compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta1'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta1'

    compile 'io.reactivex:rxandroid:1.0.1'
    compile 'io.reactivex:rxjava:1.0.14'
}

buildscript {
    ext.kotlin_version = '1.0.0-beta-1038'
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
    }
}

repositories {
    mavenCentral()
}

build.grade(模块:myProject)

// 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.3.0'

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

allprojects {
    repositories {
        jcenter()
    }
}

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

如果您需要更多信息,请告诉我。谢谢!

Solved! I have to upgrade the Kotlin Plugin from Android Studio. It started to recognise "ReadWriteProperty".