build type is not debuggable

Android studio调试时不显示变量,且通过add to watches 添加的参数变量都显示Cannot find local variable。通过debug运行时提示

“build type is not debuggable”。

根据提示可知由于编译不是debug模式导致的。

首先查看build.gradle中是否对 debuggable 参数进行了配置。

我这里没有配置,所以打开右侧Build Variants发现由于之前编译release版本的apk,所以在此处将编译类型默认设置为了release

build type is not debuggable

将模式改为debug