title: Read Jenkins environment variables in Android project? Sign APK for automated builds
body: <p>Thought I would find the answer through searching but no luck. I am planning on automating my build process and uploading builds to <code>Crashlytics Beta</code> via <code>fastlane</code> on my Jenkins server. <code>Crashlytics beta</code> requires signed APKS, but of course I don't want to add my <code>keystore</code> and password directly into my <code>build.gradle</code> file, and then into version control.</p>
  
  <p>I was pointed in the direction of Jenkins env variables. This is what I have in my Android project: </p>
  
  <pre><code>signingConfigs {
     release {
          storeFile file(ANDROID_KEYSTORE)
          storePassword ANDROID_STORE_PASSWORD
          keyAlias ANDROID_KEY_ALIAS
          keyPassword ANDROID_STORE_PASSWORD
     }
  }
  </code></pre>
  
  <p>Then in my <code>gradle.properties</code> file I have the following: </p>
  
  <pre><code>ANDROID_KEYSTORE=$ANDROID_KEYSTORE
  ANDROID_STORE_PASSWORD=$ANDROID_STORE_PASSWORD
  ANDROID_KEY_ALIAS=$ANDROID_KEY_ALIAS
  </code></pre>
  
  <p>When I try to build my project on <code>jenkins</code> via <code>fastlane</code>, I get the following error:</p>
  
  <pre><code>* What went wrong:
  Execution failed for task ':app:validateReleaseSigning'.
  &gt; Keystore file /Users/macmini/.jenkins/workspace/AndroidProject/app/$ANDROID_KEYSTORE not found for signing config 'release'.
  </code></pre>
  
  <p>One other thing, I have env in terminal and it showed me all the system env variables, the ones I had defined were not there, so I'm not entirely sure where <code>Jenkins</code> puts them. Do I need a direct path? What would that be?</p>
  
  <p>Any help is appreciated, thanks!</p>