Conditional code based on Build/flavor - Identical to C# #if DEBUG

Viewed 77

In C# there is a way to include/exclude parts of the code based on build type.

#if DEBUG
  Console.WriteLine("You are in debug");
#endif

After some search I found that using Android Studio we have things like:

flavorDimensions "dev"

productFlavors{.....}
buildTypes {
    release{.....}
    MyOwnBuildType{.....}
}

Now, I do not know how can I use them inside my code in an identical way as C#

My main issue is that in the AndroidManifest.xml I have uses-library android:required="false" but in the code I want to use it depending on the build type, and I need to find a way to exclude the parts of code where I have the "imports" and uses of the library.

0 Answers
Related