title: Android Studio 3.0 kotlin extension function 'Unresolved reference'
body: <p>I'm trying to update my project to using Android Studio 3.0 Beta 2 and I'm getting an error in my Kotlin extension functions. I have a module <code>sdk</code> which includes a few Kotlin files that provide extended functionality, an example:</p>
  
  <pre><code>fun Context.hasPermission(permission: String): Boolean =
          ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_GRANTED
  </code></pre>
  
  <p>I use this function in 2 other modules which I've changed from <code>compile project(':sdk')</code> to <code>implementation project(':sdk')</code>. When I compile now I get errors:</p>
  
  <pre><code>Unresolved error: hasPermission
  </code></pre>
  
  <p>Is there anything else I should have done when updating to get these extension functions across modules?</p>
  
  <p>UPDATE</p>
  
  <p>I changed the function signature to no longer be an extension function but instead look like:</p>
  
  <pre><code>fun hasPermission(context: Context, permission: String): Boolean
          ContextCompat.checkSelftPermission(context, permission) == PackageManager.PERMISSION_GRANTED
  </code></pre>
  
  <p>I still get the same error, if I instead wrap it inside a class or an object it works.</p>
  
  <pre><code>object ContextUtils {
      fun hasPermission(context: Context, permission: String): Boolean
              ContextCompat.checkSelftPermission(context, permission) == PackageManager.PERMISSION_GRANTED
  }
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>I ran the build with the <code>--info --stacktrace</code> flags and here's the output (there's a lot more, but this seems to be the relevant part):</p>
  
  <pre><code>:sdk:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug (Thread[Daemon worker,5,main]) completed. Took 0.231 secs.
  :experience:dataBindingExportBuildInfoDebug (Thread[Daemon worker,5,main]) started.
  :experience:dataBindingExportBuildInfoDebug
  Putting task artifact state for task ':experience:dataBindingExportBuildInfoDebug' into context took 0.002 secs.
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/java', not found
  Executing task ':experience:dataBindingExportBuildInfoDebug' (up-to-date check took 0.024 secs) due to:
    Output property 'output' file /home/yperess/workspace/Metaverse/experience/build/generated/source/dataBinding/debug has changed.
    Output property 'output' file /home/yperess/workspace/Metaverse/experience/build/generated/source/dataBinding/debug/android has been removed.
    Output property 'output' file /home/yperess/workspace/Metaverse/experience/build/generated/source/dataBinding/debug/android/databinding has been removed.
  All input files are considered out-of-date for incremental task ':experience:dataBindingExportBuildInfoDebug'.
  :experience:dataBindingExportBuildInfoDebug (Thread[Daemon worker,5,main]) completed. Took 0.033 secs.
  :experience:kaptGenerateStubsDebugKotlin (Thread[Task worker for ':',5,main]) started.
  :experience:kaptGenerateStubsDebugKotlin
  Putting task artifact state for task ':experience:kaptGenerateStubsDebugKotlin' into context took 0.0 secs.
  Executing task ':experience:kaptGenerateStubsDebugKotlin' (up-to-date check took 0.009 secs) due to:
    Output property 'destinationDir' file /home/yperess/workspace/Metaverse/experience/build/tmp/kapt3/incrementalData/debug has changed.
    Output property 'destinationDir' file /home/yperess/workspace/Metaverse/experience/build/tmp/kapt3/incrementalData/debug/com has been removed.
    Output property 'destinationDir' file /home/yperess/workspace/Metaverse/experience/build/tmp/kapt3/incrementalData/debug/com/gometa has been removed.
  All input files are considered out-of-date for incremental task ':experience:kaptGenerateStubsDebugKotlin'.
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  Using kotlin incremental compilation
  :experience:kaptGenerateStubsDebugKotlin (Thread[Task worker for ':',5,main]) completed. Took 3.386 secs.
  :experience:kaptDebugKotlin (Thread[Task worker for ':' Thread 3,5,main]) started.
  :experience:kaptDebugKotlin
  Putting task artifact state for task ':experience:kaptDebugKotlin' into context took 0.0 secs.
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  Executing task ':experience:kaptDebugKotlin' (up-to-date check took 0.012 secs) due to:
    Output property 'destinationDir' file /home/yperess/workspace/Metaverse/experience/build/generated/source/kapt/debug/com has been removed.
    Output property 'destinationDir' file /home/yperess/workspace/Metaverse/experience/build/generated/source/kapt/debug/com/gometa has been removed.
    Output property 'destinationDir' file /home/yperess/workspace/Metaverse/experience/build/generated/source/kapt/debug/com/gometa/metaverse has been removed.
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  w: warning: Supported source version 'RELEASE_7' from annotation processor 'android.arch.lifecycle.LifecycleProcessor' less than -source '1.8'
  w: 
  
  :experience:kaptDebugKotlin (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 3.489 secs.
  :experience:compileDebugKotlin (Thread[Task worker for ':' Thread 3,5,main]) started.
  :experience:compileDebugKotlin
  Putting task artifact state for task ':experience:compileDebugKotlin' into context took 0.001 secs.
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  Executing task ':experience:compileDebugKotlin' (up-to-date check took 0.035 secs) due to:
    Task.upToDateWhen is false.
  All input files are considered out-of-date for incremental task ':experience:compileDebugKotlin'.
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  file or directory '/home/yperess/workspace/Metaverse/experience/src/debug/kotlin', not found
  Using kotlin incremental compilation
  e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
      class com.gometa.metaverse.sdk.utils.MediaUploader, unresolved supertypes: com.amazonaws.mobileconnectors.s3.transferutility.TransferListener
  
  e: /home/yperess/workspace/Metaverse/experience/src/main/java/com/gometa/metaverse/experience/camera/CameraSceneViewModel.kt: (15, 39): Unresolved reference: toFile
  e: /home/yperess/workspace/Metaverse/experience/src/main/java/com/gometa/metaverse/experience/camera/CameraSceneViewModel.kt: (47, 77): Unresolved reference: toFile
  e: /home/yperess/workspace/Metaverse/experience/src/main/java/com/gometa/metaverse/experience/character/CharacterSceneViewModel.kt: (15, 39): Unresolved reference: toFile
  e: /home/yperess/workspace/Metaverse/experience/src/main/java/com/gometa/metaverse/experience/character/CharacterSceneViewModel.kt: (41, 58): Unresolved reference: toFile
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/RotationMatrix.kt: (15, 39): Unresolved reference: toString
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/RotationMatrix.kt: (161, 107): Too many arguments for public open fun toString(): String defined in kotlin.Float
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/LightLoginActivity.kt: (24, 40): Unresolved reference: hasPermission
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/LightLoginActivity.kt: (437, 36): Unresolved reference: hasPermission
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/LightLoginActivity.kt: (438, 38): Unresolved reference: hasPermission
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/component/LoginChoice.kt: (10, 34): Unresolved reference: ankoComponent
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/component/LoginChoice.kt: (30, 9): Unresolved reference: ankoComponent
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/component/LoginChoice.kt: (30, 38): Unresolved reference: it
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (9, 32): Unresolved reference: textInputEditText
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (18, 5): Unresolved reference: textInputEditText
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (19, 9): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
  public var TextView.hintResource: Int defined in org.jetbrains.anko
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (20, 9): Unresolved reference: inputType
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (21, 9): Unresolved reference: maxLines
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (22, 9): Unresolved reference: filters
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (23, 9): Unresolved reference: addTextChangedListener
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (34, 13): Unresolved reference: textInputEditText
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (35, 17): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
  public var TextView.hintResource: Int defined in org.jetbrains.anko
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (36, 17): Unresolved reference: inputType
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (37, 17): Unresolved reference: maxLines
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/login/util/Layouts.kt: (38, 17): Unresolved reference: addTextChangedListener
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/view/CameraControlView.kt: (32, 39): Unresolved reference: clamp
  e: /home/yperess/workspace/Metaverse/experience/src/main/kotlin/com/gometa/metaverse/experience/view/CameraControlView.kt: (305, 26): Unresolved reference: clamp
  [KOTLIN] deleting /home/yperess/workspace/Metaverse/experience/build/tmp/kotlin-classes/debug on error
  [KOTLIN] deleting /home/yperess/workspace/Metaverse/experience/build/tmp/kotlin-classes/debug on error
  :experience:compileDebugKotlin FAILED
  :experience:compileDebugKotlin (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 8.489 secs.
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':experience:compileDebugKotlin'.
  &gt; Compilation error. See log for more details
  
  * Try:
  Run with --debug option to get more log output.
  
  * Exception is:
  org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':experience:compileDebugKotlin'.
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
      at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63)
      at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
      at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
      at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:88)
      at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
      at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
      at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
      at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
      at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
      at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:124)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:80)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:105)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:99)
      at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
      at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
      at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:99)
      at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
      at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
      at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
  Caused by: org.gradle.api.GradleException: Compilation error. See log for more details
      at org.jetbrains.kotlin.gradle.tasks.TasksUtilsKt.throwGradleExceptionIfError(tasksUtils.kt:8)
      at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.processCompilerExitCode(Tasks.kt:326)
      at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:300)
      at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:203)
      at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:182)
      at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73)
      at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$IncrementalTaskAction.doExecute(DefaultTaskClassInfoStore.java:173)
      at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:134)
      at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:121)
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:122)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:197)
      at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:107)
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:111)
      at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
      ... 27 more
  
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 1m 55s
  88 actionable tasks: 88 executed
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>Removing <code>testCoverageEnabled = true</code> fixed the issue of the missing global functions. Now I'm just left with the error on Amazon's S3 which I think belongs in a different question.</p>