[英]How can I know if my android app was built in release or debug mode?
In my app I use Google Analytics and Admob as you know (or not) I can use both of them in a mode that doesn't influences the data on the server (debug mode). 在我的应用中,我使用谷歌分析和Admob你知道(或不)我可以在不影响服务器数据的模式下使用它们(调试模式)。
I tired of changing each time I release my app this things and I can also mistake and release it with debug mode and then I won't get data... 我厌倦了每次我发布我的应用程序时更改这些东西,我也可能会错误并使用调试模式释放它然后我将无法获取数据...
How can I know programmatically if I run in debug\\release mode? 如果我在调试\\发布模式下运行,我怎么能以编程方式知道?
In C# I can check this using: 在C#中我可以使用以下方法检查:
#If DEBUG then
How can I do this in Android? 我怎样才能在Android中执行此操作?
You can try by checking the flag 您可以尝试检查标志
BuildConfig.DEBUG
And this is how I use normally. 这就是我正常使用的方式。
if (BuildConfig.DEBUG) {
Log.e(Constants.TAG, "onCreate called");
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.