Android Studio中未解决的引用currentThread()。wait()与kotlin

我有同样的问题在这里问。 我想申请接受的答案。 但是我无法做到这一点,因为IDE说:

Thread.currentThread().wait(); 

“等待”是一个未解决的参考。 我在Android Studio中使用kotlin,所以也许kotlin插件导致这个问题。 在首选项的插件部分中提到,我已经安装了1.0.6-release-Studio2.2-1 kotlin版本。 而在项目build.gradle:

 buildscript { ext.kotlin_version = '1.0.6' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "io.realm:realm-gradle-plugin:2.3.0" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } 

如果我将kotlin_version更改为1.0.6-release-Studio2.2-1 Ide指出Kotlin version that is used for building with Gradle (1.0.6-release-Studio2.2-1) differs from the one bundled into the IDE plugin (1.0.6)

所以我的第一个问题是如何处理未解决的参考错误。 第二个:还有其他更好的方法来强制IntentService等待,直到DownloadManager完成下载并按照这个问题调用onReceive()。

请参阅https://kotlinlang.org/docs/reference/java-interop.html ,在页面中间的某处:

有效的Java Item 69建议优先使用并发实用程序wait()和notify()。 因此,这些方法在Anytypes的引用上不可用。 如果你真的需要调用它们,你可以转换为java.lang.Object(foo as java.lang.Object).wait()