First of all, the most similar question that I found is this Intellij IDEA: Breakpoint not being hit, and is shown greyed out but that is not the exact same case.
I
I fixed this by manually deleting all build-related files (for some reason Rebuild did nothing) by running this command at the project's root folder. Note that it does also remove Intellij's temporary configuration files, that are usually not included in git repositories anyway. Replace MODULE with the subfolder containing the module for the project. If you are building an Android app with Android Studio the main module name is usually app
.
rm -rf ./local.properties ./.gradle/ ./.idea/ ./MODULE/build/ ./MODULE/out/
Then restart Intellij with the File -> Invalidate Caches / Restart
option, wait for the build and indexing to finish, and debugging should start working again.