Reputation: 1759
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
?
I've also had this problem with earlier versions.
Upvotes: 12
Views: 12787
Reputation: 81
In my case when i added id 'kotlin-android-extensions'
to gradle file (app) and synced, problem is solved.
Upvotes: 0
Reputation: 285
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.
Upvotes: 7
Reputation: 192
The also function was added in Kotlin 1.1 but you have your Language version set to 1.0. Go to your settings/preferences and change the Kotlin version to 1.1.
Upvotes: 5