• 15

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

Where are build types of the app defined?

  1. I know we can edit build types in Android Studio:

    Build Types

  2. I know we can edit each build type setting in gradle:

    android {
        buildTypes {
            release {
                minifyEnabled true
  3. I know we can detect build types in code. How do I detect if I am in release or debug mode?

But where actually are the build types defined? Let say I want to commit it to git. What should I do to keep build types of the project consistent?

      • 2
    • BuildConfig class gets generated inside following path "app/build/generated/source/buildConfig/yourBuildType/yourPackageName/BuildConfig.java"
      • 1
    • You should not make it consistent. because, it's generated class and it should be get generated upon every successful clean/re build.
      • 1
    • @JeelVankhede 1. So the BuildConfig.BUILD_TYPE in code comes from what Android Studio injected when we run a build? 2. As a developer, we should rely on the buildTypes specified in build.gradle to config our Android Studio to match them. Correct?
      • 1
    • Yes, that's correct, we can totally rely on BuildConfig class. But just to make you clear, Android studio doesn't inject anything but it's compiler which generates such classes.
    • @JeelVankhede Got it! I think this is a valid answer. Could you sum it and post an answer so I can accept it?

Where actually are the build types defined?

Basically, BuildConfig is the auto-generated class that resides under path :


This class holds variables provided by buildTypes {} block from app level build.gradle file. So, on every clean & rebuild of project, Gradle auto generates BuildConfig class that can be used in further Android development environment.

I.e. BuildConfig.DEBUG is the default variable that we can use in our application code to determine it's buildType.

We can provide our own fields through buildType from build.gradle file like following:

android {
. . .
    buildTypes {
        debug {
            buildConfigField "String", "SOME_VARIABLE", '"This string value is from build config class"'
. . .
  • 1
Reply Report