BuildConfig.DEBUG始终返回false [英] BuildConfig.DEBUG always return false
本文介绍了BuildConfig.DEBUG始终返回false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我运行应用程序时,为什么BuildConfig.DEBUG
返回false?
Why does BuildConfig.DEBUG
return false, when I run the application?
我用它来控制日志,如下所示:
I use it to control the log like the following:
public static void d(String LOG_TAG, String msg){
if(BuildConfig.DEBUG){
Log.d(LOG_TAG,msg);
}
}
推荐答案
在您的Android Studio 构建变体中,您是否正在使用 debug 变体?
In your Android Studio build variant are you on debug variant?
在debug
或release
中使用flavors
时适用.
在调试模式下,BuildConfig.BUILD
为true,在发布模式下,为false.
in the debug mode, BuildConfig.BUILD
is true, and in the release mode, it is false.
这篇关于BuildConfig.DEBUG始终返回false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文