Config.LOGD已弃用

Config.LOGD已弃用

问题描述:

在android.util.Config中,现在不推荐使用Config.LOGD,Config.LOGV。你能告诉我如何重构我的代码,以摆脱编译器生成的警告?Config.LOGD已弃用

谢谢。

您应该使用Config.DEBUG(在调试模式下为true)而不是Config.LOGD。

+0

Config.DEBUG何时会为true,何时会为false?它是否由Manifest文件确定?谢谢。 – michael 2011-03-28 22:30:00

是的,Robby的意思是它。请参阅开源代码的说明。

public final class Config 
{ 
    /** 
    * If this is a debug build, this field will be true. 
    */ 
    public static final boolean DEBUG = ConfigBuildFlags.DEBUG; 

PS:我只是想将上面的单词设置为注释,但我不知道如何设置为注释,所以我只能设置为另一个答案。

Config.DEBUG不推荐使用BuildConfig.DEBUG来代替。

有关如何在Android应用程序中使日志记录更加一致的信息,请参阅适用于Android(iosched)的Google I/O应用程序源代码以供参考。 http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/LogUtils.java