vishnus
vishnus

Reputation: 728

Cannot watch Kotlin variable in android studio

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?

Upvotes: 19

Views: 3953

Answers (3)

user4199560
user4199560

Reputation: 1

file> invalidate caches / restart .. fixed it for me

Upvotes: 0

Josef Adamcik
Josef Adamcik

Reputation: 5780

This bug should be already fixed in new Dex compiler.

Try to enable it by adding:

android.enableD8=true

to your gradle.properties.file

For more details check official blogpost.

Upvotes: 0

Pointer Null
Pointer Null

Reputation: 40380

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

Upvotes: 6

Related Questions