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()
- 我现在正在用Kotlin开发一个Android应用程序,但是发生了一个错误:CompilationException:无法将方法调用“readText”内联到
- 如何关闭片段中的软键盘
- android自定义视图findviewId为null并且不可见
- 本地函数访问具有相同名称的父variables
- 我的TextView看不到
- 如何在坐标x,y Android中查看元素
- 如何为kotlin中的函数参数设置不为null
- 如何使用kotlin显示在recyclerview中选择的单个项目
- com.android.builder.dexing.DexArchiveMergerException:无法在运行时合并dexexception