什么时候ADT设置BuildConfig.DEBUG为假?什么时候、ADT、DEBUG、BuildConfig

2023-09-12 02:49:40 作者:帅到惊动联合国

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

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

  

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

解决方案

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

十一假期要追剧 6个珍藏已久的影视资源网站送给你,低调收藏吧

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.