title: Android: How To Access await() method in Ion Library
body: <p>I am using <a href="https://github.com/koush/ion" rel="nofollow noreferrer">ion</a>, a library for Android. As shown in <a href="https://github.com/koush/ion/tree/master/ion-kotlin" rel="nofollow noreferrer">ion-kotlin</a>, one can use a method called <code>await()</code> like so:</p>
  <pre><code>fun getFiles(files: Array&lt;String&gt;) = async {
      for (file in files) {
          Ion.with(context)
          .load(file)
          .asString()
          .await()
      }
  }
  </code></pre>
  <p>I copy pasted that exact function into my <code>MainActivity</code> class, as a test. However, I got the error &quot;unresolved reference: await&quot; in Android Studio.</p>
  <p>This was confusing because my app's <code>build.gradle</code> file has the following two lines:</p>
  <pre><code>implementation 'com.koushikdutta.ion:ion:2.+'
  implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.5'
  </code></pre>
  <p>This brings me to my first question, how can I use the <code>.await()</code> method in the ion library?</p>
  <p>I thought that maybe I had to manually download <a href="https://github.com/koush/ion/blob/master/ion-kotlin/src/com/koushikdutta/ion/kotlin/AsyncAwait.kt" rel="nofollow noreferrer">AsyncAwait.kt</a>, which was the only file in the source folder of <a href="https://github.com/koush/ion/tree/master/ion-kotlin" rel="nofollow noreferrer">ion-kotlin</a>.</p>
  <p>So, I downloaded that file and placed it in my project's package. I changed the package declaration at the top of the downloaded file from <code>package com.koushikdutta.ion.kotlin</code> to <code>package com.example.vroy1.recylerviewtest</code>.</p>
  <p>That seemed to partially solve the problem because I no longer had the &quot;unresolved reference: await&quot; error in Android Studio.</p>
  <p>But, the file AsyncAwait.kt refuses to compile. I am getting several errors.</p>
  <p>One of the errors is occurring at an import statement at the top of the file. The error is:</p>
  <p><a href="https://i.stack.imgur.com/lnwlD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lnwlD.png" alt="Screen_Shot" /></a></p>
  <p>This brings me to my second question. If the only way to use <code>.await()</code> is to manually download AsyncAwait.kt, how can I fix this error so the file will compile?</p>