Select the debug build variant when Android Studio refuses to attach a debugger to a release build.
When Android Studio reports build type isn't debuggable, open the Build Variants tool window, locate the module, and change its active variant from release to debug.