Cannot watch Kotlin variable in android studio

android-studio, debugging, kotlin

Solution

That's bug in Android studio.

1) I've reported mentioned bug (or very similar) recently: https://issuetracker.google.com/issues/62859634

2) If you find a bug in tools, report it to Google: https://issuetracker.google.com/issues/new

Problem

I am not able to get android studio display the value of a calculation in the watches window. I use Kotlin for development and when i try to add a value to watches, i get a message which says "An exception occurs during evaluate expression". e.g. ``` val model = MyModel() val pos = model.position ``` Now if I add `model.position` to watches, then it gives the above error and the value of the expression is not displayed. How can I fix this?

Original source