Environment variable null in Android Gradle build

Hello,
Any environment variable I set via the UI is always null when fetched in my Android gradle build. I have a function which tries to return values from a properties file when running local builds, but on the CI environment in Circle it fetches from the environment variable since this file isn’t checked into source control.

e.g.
getPropOrEnvValue = { param1, param2 -> def val = keystoreProperties[param1] != null ? keystoreProperties[param1] : "$System.env.param2" println('ENV ' + param2 + " = " + val) return val }

keyAlias getPropOrEnvValue('keyAlias', 'KEY_ALIAS')

I’ve seen a few threads from a year or two ago indicating Gradle can’t read env variables within Circle, and that you need to add them to gradle.properties via a script. This seems a bit of an inconvenience, is this still the case or am I just doing things wrong?

FYI,
Using Circle 2.0, with a small modification to the circleci/android:api-26-alpha image.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.