[Solved] Why do I see “No Debuggable Applications” in Android Studio Logcat while my application is running?

I wanted to filter what is shown in the Android Studio Logcat to show what is relevant to my application only. I have chosen Show only selected applications from the drop down at the top of the logcat as shown in the following screenshot:

But in the drop down menu above it which is supposed to show running application(s) (and other options) from which we can choose our application to see Log messages related to it only, I see No debuggable Applications as the only option.

Why? What should I do to fix this?

Note: It does not happen every time I run the project. Sometimes it happens, sometimes it automatically selects my app (when I run it) from the drop down menu shown in the second screenshot, and filters the results properly.