什么时候ADT设置BuildConfig.DEBUG为假? [英] When does ADT set BuildConfig.DEBUG to false?

查看:212
本文介绍了什么时候ADT设置BuildConfig.DEBUG为假?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ADT(R17)的产生不断加入最新版本的 BuildConfig.DEBUG 即根据生成类型设置。我的问题是,它是永远不会设置为false,我希望它做的时候改变Android的工具 - >导出签名的应用程序包,但它不适合我。

那么,如何改变构建类型?

  

增加了一个功能,可以让您仅在调试模式下运行一些code。   现在建立生成包含调试一类被称为BuildConfig   常量,它是根据你的编译类型自动设置。您   可以检查(BuildConfig.DEBUG)定在code运行   调试只有函数

解决方案

目前,您可以通过禁用自动构建,清理项目得到正确的行为,然后通过出口Android的工具 - >导出签名的应用程序包。当你运行应用程序 BuildConfig.DEBUG 应该是假的。

In the newest version of ADT (r17) a generated constant was added BuildConfig.DEBUG that is set according to the build type. The problem I have is that it is never set to false, I expected it to change when doing "Android Tools -> Export Signed Application Package" but it hasn't for me.

So how do I change the build type?

Added a feature that allows you to run some code only in debug mode. Builds now generate a class called BuildConfig containing a DEBUG constant that is automatically set according to your build type. You can check the (BuildConfig.DEBUG) constant in your code to run debug-only functions

解决方案

Currently you can get the correct behavior by disabling "Build Automatically", cleaning the project and then export via "Android Tools -> Export Signed Application Package". When you run the application BuildConfig.DEBUG should be false.

这篇关于什么时候ADT设置BuildConfig.DEBUG为假?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆