mars3142
mars3142

Reputation: 2561

Gradle: one build type based on another

I have 4 build types in Android Studio:

release
debug
kindle
kindle_debug

How is it possible to set the both kindle tasks to use the same data from release/debug and just changing some properties?

Upvotes: 1

Views: 291

Answers (1)

Francesco
Francesco

Reputation: 392

You can use initWith to inherit from another BuildType like in this example:

android {
[...]
   buildTypes {            
            debug {
                debuggable true
                buildConfigField "boolean", "IS_V2", "false"
            }
            debugV2 {
                initWith debug
                buildConfigField "boolean", "IS_V2", "true"
                applicationIdSuffix ".v2"
            }
      }
   }
}

Then select debugV2 from Build Variants in Android Studio.

See also the docs here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types

Upvotes: 2

Related Questions