简体   繁体   中英

BuildConfig.DEBUG remains true

I've read the other questions about it here.
And I cleaned my source and set android:debuggable to false.
The only result is the warning, that I should not hardcode this.

And of course BuildConfig.DEBUG remains true!

Who knows really why and what to do?

I've also seen reports of BuildConfig.DEBUG being unreliable, although I have not used it.

I have successfuly used:

    //Figure out if we are in debug mode or not
    boolean debugMode = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));

Which reads the debuggable tag in AndroidManifest.xml.

Also, there is a Lint warning that goes further by saying, don't set that tag, android will figure it out for you.

When you do a proper export of an apk, it should set it to false. Not sure if it matters if it is signed or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM