I am trying to remove logging from the release apk file. I followed the advice of using BuildConfig.DEBUG
variable, which will be true for debug builds and false otherwise.
In a Constants file, I have:
public static final LOG_ENABLED = BuildConfig.DEBUG;
And then I check the variable before logging.
if(Constants.LOG_ENABLED){
// print Log
}
Then, in the gradle
build file, I have added android
{ buildTypes { release { minifyEnabled true shrinkResources true } } }
. I then ran gradle assembleRelease
, but the logging still remains inside the apk file?
Can someone kindly show me the error of my ways?
答案 0 :(得分:0)
Ciao
很抱歉参加晚会,但是:
在您的代码段中,我认为您可能必须明确使用boolean
类型:
public static final boolean LOG_ENABLED = BuildConfig.DEBUG;
BuildConfig.DEBUG;
受known issues-也受with libraries-的影响,例如here都可以找到Eclipse和Android Studio的解决方案希望有帮助
祝你有美好的一天,
安东尼诺