Android + Kotlin + Unresolved references

Today I encountered a really strange error...

I'm using the latest Android Studio and Kotlin versions, however when I tried to reference the ConstraintLayout into the code - the compiler cried out - Oh, no! Unresolved reference to class ConstraintLayout

I was shocked because I couldn't understand why it's happening. The ConstraintLayout was imported and working fine in the XMLs.

The solution was to delete the {project_dir}/.idea/libraries dir, sync the project with gradle files: File -> Sync project with gradle files.

Luckily, it resolved the problem! :)