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

我在Android Studio中使用了Kotlin 1.0.0-beta-1038版本的Android项目。

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

未解决的参考:ReadWriteProperty

未解决的参考:ReadWriteProperty

名为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(Module: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 } 

请让我知道,如果你需要更多的信息。 谢谢!

解决了! 我必须从Android Studio 升级Kotlin插件 。 它开始识别“ReadWriteProperty”。