Android Studio and Kotlin: Unresolved reference: also

Love picture Love · Jul 17, 2017 · Viewed 10k times · Source

also compiles and runs from Android Studio:

val greeted = "World".also { println("Hello $it") }

Yet the editor highlights also and it as errors and don't give any help with intellisense. apply still works and when I go to source I can see the definition of both apply and also. How do I get Android Studio to recognize also?

  • Android Studio 2.3.3
  • kotlin_version = '1.1.3-2'
  • Kotlin plugin 1.1.3-release-Studio2.3-2

I've also had this problem with earlier versions.

Answer

Ardi picture Ardi · Dec 22, 2019

I tried everything possible and nothing worked. The only solution for me was to delete .AndroidStudio folder from C:/Users/YourName/. Android Studio resets and everything works as it should.