R.id.X values are wrong during debugging

Viewed 268

enter image description here

If I do this in code: val x = R.id.x - it will have value like 32123123412.

If I evaluate expression/add to variables watcher this during debug: R.id.x - it will have value like -123456 and x == R.id.x - will be false. It also means that findViewById<View>(R.id.x) will found nothing, while findViewById<View>(x) - will work just fine during debugging.

For some reason all R values during debug differ from values in code. I found file R.txt in build and it had 32123123412 for R.id.x. But I found no files with -123456.

Where does -123456 comes from? How can I make R.id.x same in code and during debug? This is extremely bad during espresso tests debugging.

UPD: problem occurs only in kotlin files. If I create java file and call it from kotlin and check ids there - it will work fine

UPD2: android.R.id.content works fine even in kotlin

UPD3: if in evaluate expression menu choose java and try to see R.id.X - R - will be unresolved reference, even if package fully specified

UPD4: opened task in kotlin bugtracker https://youtrack.jetbrains.com/issue/KT-42479

1 Answers
Related