Skip to content Skip to sidebar Skip to footer

Android Studio Does Not Honor Environment Variables

I am trying to pass environment specific values to Android studio v 2.2.2 (such as server url, keystore location and password) by setting java vm arguments. So far I've tried follo

Solution 1:

I have done investigation based on the comments by @DeeV and @CommonsWare and have done some changes to run the build successfully on Android Studio as well as on command line.

  1. I have placed gradle.properties file in Gradle's home directory. In my environment (ubuntu) the gradle home directory is located at ~/.gradle.

  2. I have to remove the System.env. from the usage of the variables, so this way it uses the properties declared in gradle.properties file.

With these two changes, I noticed that the Android Studio problem got resolved. However this has caused another problem, the CL build was failing with error: Failed to read key relase_key from store "/home/ubuntu/ks/myapp/app-release.keystore": Keystore was tampered with, or password was incorrect. This means the gradle when run from CL can resolve the path but fails to read key from KS.

I have to do the following step to get rid of this error:

  1. In the gradle.properties, I had put the values for RELEASE_KEY_PASSWORD and RELEASE_KEY_STORE_PASSWORD in double quotes, I removed the quotes and then the build completed successfully from command line.

I hope this will help anyone who face similar situation.

Post a Comment for "Android Studio Does Not Honor Environment Variables"