title: Unresolved reference currentThread().wait() with kotlin in Android Studio
body: <p>I have the same question as asked <a href="https://stackoverflow.com/q/27590160/4656400">here</a>. I wanted to apply the accepted answer. But I was unable to do that, because IDE stated that in the line:</p>
  
  <pre><code> Thread.currentThread().wait();
  </code></pre>
  
  <p>"wait" was an unresolved reference. I use kotlin in Android Studio so maybe kotlin plugin causes the problem. In plugins section of Preferences stated that I have 1.0.6-release-Studio2.2-1 kotlin version installed. Whereas in the project build.gradle:</p>
  
  <pre><code>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
  }
  </code></pre>
  
  <p>If I change kotlin_version to be 1.0.6-release-Studio2.2-1 Ide points that <code>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)</code>.</p>
  
  <p>So my first question is how to deal with the unresolved reference error.
  And the second: is there other/better way to force IntentService to wait until DownloadManager finishes its download and calls onReceive() as asked in <a href="https://stackoverflow.com/q/27590160/4656400">this</a> question.</p>