1. Are you ready for the Galaxy S20? Here is everything we know so far!

What is a BuildType in Gradle? And what can you use it for?

Discussion in 'Android Lounge' started by jamesmark147, Jul 17, 2019.

  1. jamesmark147

    jamesmark147 Lurker
    Thread Starter

    Provide the answer of this question effective and short.
     


  2. Best Answer:
    Post #2 by Deleted User, Jul 17, 2019 (1 points)

    1. Download the Forums for Android™ app!


      Download

       
  3. Deleted User

    Deleted User Guest

    You can configure different build types depending on your intended deployment.
    Example:

    Code (Text):
    1.  
    2. android {
    3.     defaultConfig {
    4.         manifestPlaceholders = [hostName:"www.example.com"]
    5.         ...
    6.     }
    7.     buildTypes {
    8.         release {
    9.             minifyEnabled true
    10.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    11.         }
    12.  
    13.         debug {
    14.             applicationIdSuffix ".debug"
    15.             debuggable true
    16.         }
    17.  
    18.         /**
    19.          * The `initWith` property allows you to copy configurations from other build types,
    20.          * then configure only the settings you want to change. This one copies the debug build
    21.          * type, and then changes the manifest placeholder and application ID.
    22.          */
    23.         staging {
    24.             initWith debug
    25.             manifestPlaceholders = [hostName:"internal.example.com"]
    26.             applicationIdSuffix ".debugStaging"
    27.         }
    28.     }
    29. }
    30.  
    See here for a fuller explanation:

    https://developer.android.com/studio/build/build-variants
     
    MoodyBlues and GameTheory like this.
  4. MoodyBlues

    MoodyBlues Compassion is cool!
    VIP Member

    I see LV has graciously answered your rather impolite demand. For what it's worth, a 'please' or 'thanks in advance' can go a long way.
     
    Greum likes this.
  5. Deleted User

    Deleted User Guest

    Don't worry Moody. It's a kind of bonus when someone does actually acknowledge, or give thanks for the free advice they get ;)
    But I thank you for your recognition.
     
    MoodyBlues likes this.
Loading...
Similar Threads - BuildType Gradle
  1. Dan Coleman
    Replies:
    0
    Views:
    270
  2. Pravinkumar Putta
    Replies:
    2
    Views:
    911
  3. RebelCommander
    Replies:
    0
    Views:
    741
  4. Pei Liu
    Replies:
    1
    Views:
    1,132
  5. Sathish Mohan
    Replies:
    0
    Views:
    330
  6. kannanthayumanavan
    Replies:
    5
    Views:
    1,769
  7. Mekhi Greene
    Replies:
    3
    Views:
    607
  8. ClintonBrits
    Replies:
    1
    Views:
    460
  9. mcpixel
    Replies:
    0
    Views:
    471
  10. mcpixel
    Replies:
    2
    Views:
    959

Share This Page

Loading...