Check that your build variant is set to debug and not release. In Android Studio go to the Build menu > Select Build Variant > in the Build Variants window set the 'Active Build Variant' for module ':app' to Debug.
If you have it set to Release it is likely not working because your build.gradle file has the 'debuggable' attribute set to false.