Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio and Kotlin: Unresolved reference: also

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.

like image 826
Love Avatar asked Jul 17 '17 14:07

Love


People also ask

Why is Kotlin synthetic deprecated?

Synthetic properties to access views were created as a way to eliminate the common boilerplate of findViewById calls. These synthetics are provided by JetBrains in the Kotlin Android Extensions Gradle plugin (not to be confused with Android KTX).

What is Parcelize in Kotlin?

The kotlin-parcelize plugin provides a Parcelable implementation generator. To include support for Parcelable , add the following Gradle plugin to your app's build.gradle file: plugins { id 'kotlin-parcelize'


1 Answers

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.

like image 69
Ardi Avatar answered Oct 18 '22 21:10

Ardi