Issue
I am trying to launch my application in debug mode by using the little debug icon on the right of the run icon. i assumed this is the way to start debug mode.
The problem is that i am checking BuildConfig.DEBUG
to see if i am in debug mode but it's always true and when i want to check in generated build.config file i found : public static final boolean DEBUG = Boolean.parseBoolean("true");
My question is : am i doing something wrong in launching debug? is it not the way we do it? how can i use debug mode?
Solution
You're confusing debugging with a debug build.
BuildConfig.DEBUG
is an indication of whether or not your app is a debug build or a release build, it doesn't have anything to do with launching the app to debug. Even launching the app by just running it will also have BuildConfig.DEBUG
as true, because it's still a debug build, this will only change once you actually create a signed release.
The icon you're referring to attaches the android debugger to the process, allowing you to use breakpoints, but it generates the same output as it would by simply running the app as well.
BuildConfig.DEBUG
will only be false once you create a signed release build, so it has nothing to do with launching the app to debug
Answered By - a_local_nobody
Answer Checked By - Katrina (JavaFixing Volunteer)