I am having a KEY_STRING as system variable in mac OSX and Windows. Which has absolute path to my keystore.
~/.bash_profile entry would be
export KEY_STRING =~/config/release-signing.keystore
Same path setup in each of my team mates machines[Windows/OSX/Linux].
My Gradle script to access this variable would be
def keystorePath = System.getenv("KEY_STRING");
println keystorePath;
This script works fine in Windows in both console and android studio.
My problem specific to mac android studio.
If I run the build in terminal which is working fine and reads the env variable.
But when I do gradle sync or set up run configuration [Gradle task] it cannot resolve the variable.
I have reported this issue to Google as well.
Again here is the quick summary:
Read it anywhere in build.gradle
def keystorePath = System.getenv("KEY_STRING"); println keystorePath;
Add gradle task in configuration.
None of the OSX apps can read the environment variable.
As per this answer https://stackoverflow.com/a/14285335/981555
solution for my problem would be
launchctl setenv KEY_STRING ~/config/release-signing.keystore
This should be set before launching Android studio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With