Your XML layout and Kotlin file might not be connected properly.
Common Fixes:
- Check your Activity/Fragment Kotlin file: Ensure the package
declaration is present at the top (e.g., package com.app_name...).
- Check your XML layout: Verify the tools:context attribute is set
(e.g., tools:context=".YourActivity").
- Invalidate Caches and Restart Android Studio: Go to File >
Invalidate Caches / Restart to clear any corrupted caches.
Missing these lines or having corrupted caches can break the connection between your code and layout.