title: Access to environment variables from Android Studio gradle build
body: <p>In my Android Gradle build I need to get access to environment variables I set from <code>.bash.profile</code>. It works fine when I build from command line - Gradle script can see all the variables. </p>
  
  <p>However, when I try to run my build from Android Studio - I don't have my environment variables anymore.</p>
  
  <p>Here is a rough picture of what I'm facing:</p>
  
  <p>1) Set custom environment variable via <code>~/.bash.profile</code>:</p>
  
  <pre><code>export MY_CUSTOM_VAR='Hello World'
  </code></pre>
  
  <p>2) In <code>build.gradle</code> create task which prints this environment variable:</p>
  
  <pre><code>task printVar &lt;&lt; {
      println System.getenv("MY_CUSTOM_VAR")
  }
  </code></pre>
  
  <p>3) execute <code>printVar</code> from command line. Output is correct - env variable is set:</p>
  
  <p>output: <code>Hello World</code></p>
  
  <p>4) execute <code>printVar</code> from Android Studio. Environment variable <strong>is not set</strong>. Output is empty</p>
  
  <p>Common sense tells me that by doing <code>export MY_CUSTOM_VAR='Hello World'</code> I just make this variable available to shell process (and its subprocesses). And it would probable work if I launch my Android Studio from command line (so it would inherit my environment). But since I launch Android Studio from dock (i'm on Mac by the way) - it has its own environment which doesn't have any idea about my <code>~/.bash.profile</code>.</p>
  
  <p>Is there any way I can populate custom environment variables to Android Studio?</p>