How to set a variable during configuration phase based on buildType?

I am trying to set some variables during configuration phase based on buildTypes(debug, release). How do I achieve this? I am building an android application.