You would like to enable analytics tracking only in release builds. How can you create a new field in the generated BuildConfig class to store that value?

  • buildTypes {
    debug {
    buildConfig ‘boolean’, ‘ENABLE_ANALYTICS’, ‘false’
    }
    release {
    buildConfig ‘boolean’, ‘ENABLE_ANALYTICS’, ‘true’
    }
    }
  • buildTypes {
    debug {
    buildConfig ‘String’, ‘ENABLE_ANALYTICS’, ‘false’
    }
    release {
    buildConfig ‘String’, ‘ENABLE_ANALYTICS’, ‘true’
    }
    }
  • buildTypes {
    debug {
    buildConfigField ‘boolean’, ‘ENABLE_ANALYTICS’, ‘false’
    }
    release {
    buildConfigField ‘boolean’, ‘ENABLE_ANALYTICS’, ‘true’
    }
    }
  • buildTypes {
    debug {
    buildConfigField ‘boolean’, ‘ENABLE_ANALYTICS’, ‘true’
    }
    release {
    buildConfigField ‘boolean’, ‘ENABLE_ANALYTICS’, ‘false’
    }
    }
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment

Share via
G Certification Course We would like to show you notifications for the latest news and updates.
Dismiss
Allow Notifications
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend