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?
Kotlin uses two different keywords to declare variables: val and var . Use val for a variable whose value never changes. You can't reassign a value to a variable that was declared using val . Use var for a variable whose value can change.
Android Studio provides full support for Kotlin, enabling you to add Kotlin files to your existing project and convert Java language code to Kotlin. You can then use all of Android Studio's existing tools with your Kotlin code, including autocomplete, lint checking, refactoring, debugging, and more.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With