4

I want to execute some code depending on the build type (release, debug). specifically, i want to change the APK name depending on the build type ... something like this,

if (buildType.name == 'release') {
  project.archiveBaseName = 'blah';
} else if (buildType.name == ...) {
  ...
}

I don't know where to put this code however. I can iterate over the build types,

android.buildTypes.each{ type ->
    print type.name
}

but this of course gives me all the build types, not the current build type.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Jeffrey Blattman
  • 22,176
  • 9
  • 79
  • 134

1 Answers1

1

I suppose that buildTypes is the feature you need: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types

android {
    buildTypes {
        debug {
            packageNameSuffix ".debug"
        }
    }
}

Does it help?

Jean Lestang
  • 861
  • 9
  • 9