title: Kotlin - unresolved reference for constant
body: <p>I'm trying to use the sample code of the new camera hardware API (android.hardware.camera2) for my android app. First, I converted the Java code to Kotlin code by the automatic conversion feature of the Kotlin plugin for Android Studio. Below is a piece of the converted code:</p>
  
  <pre><code>private val mCaptureCallback = object : CameraCaptureSession.CaptureCallback() {
  
      private fun process(result: CaptureResult) {
          when (mState) {
              STATE_PREVIEW -&gt; {
              }// We have nothing to do when the camera preview is working normally.
              STATE_WAITING_LOCK -&gt; {
                  val afState = result.get(CaptureResult.CONTROL_AF_STATE)
                  if (CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED == afState || CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED == afState) {
                      // CONTROL_AE_STATE can be null on some devices
                      val aeState = result.get&lt;Int&gt;(CaptureResult.CONTROL_AE_STATE)
                      if (aeState == null || aeState == CaptureResult.CONTROL_AE_STATE_CONVERGED) {
                          mState = STATE_WAITING_NON_PRECAPTURE
                          captureStillPicture()
                      } else {
                          runPrecaptureSequence()
                      }
                  }
              }
              STATE_WAITING_PRECAPTURE -&gt; {
                  // CONTROL_AE_STATE can be null on some devices
                  val aeState = result.get&lt;Int&gt;(CaptureResult.CONTROL_AE_STATE)
                  if (aeState == null || aeState == CaptureResult.CONTROL_AE_STATE_PRECAPTURE || aeState == CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED) {
                      mState = STATE_WAITING_NON_PRECAPTURE
                  }
              }
              STATE_WAITING_NON_PRECAPTURE -&gt; {
                  // CONTROL_AE_STATE can be null on some devices
                  val aeState = result.get&lt;Int&gt;(CaptureResult.CONTROL_AE_STATE)
                  if (aeState == null || aeState != CaptureResult.CONTROL_AE_STATE_PRECAPTURE) {
                      mState = STATE_PICTURE_TAKEN
                      captureStillPicture()
                  }
              }
          }
      }
  </code></pre>
  
  <p>I'm getting the unresolved reference error for:</p>
  
  <pre><code>CaptureResult.CONTROL_AF_STATE_FOCUSED_LOCKED
  CaptureResult.CONTROL_AF_STATE_NOT_FOCUSED_LOCKED
  CaptureResult.CONTROL_AE_STATE_CONVERGED
  CaptureResult.CONTROL_AE_STATE_PRECAPTURE
  CaptureRequest.CONTROL_AE_STATE_FLASH_REQUIRED
  </code></pre>
  
  <p>But these constants are recognized in the original Java code. There's any solution for these errors?</p>