title: How do I set an environment variable in Android Studio before it runs my gradle build
body: <p>My Gradle build looks at an environment variable called BUILD_NUMBER to determine the version to allocate to my android application as follows:</p>
  
  <pre><code>def buildNumber = System.getenv("BUILD_NUMBER") ?: "local"
  </code></pre>
  
  <p>So as long as that environment variable is set, the build number is used in defaultConfig as follows:</p>
  
  <pre><code>versionName "1.4.0."+buildNumber
  </code></pre>
  
  <p>Usually, Jenkins will call this Gradle build and supply the BUILD_NUMBER environment variable.</p>
  
  <p>If I run the Gradle build from my command prompt, I know I can set BUILD_NUMBER = x.</p>
  
  <p>However, if I build using Android Studio, how can I set the BUILD_NUMBER environment variable through Android Studio itself?</p>