Gradle get system environment variables

On mac, if I use this in gradle:

androidSdk ="$System.env.HOME"

      

it delivered the output: / Users / MyName /

and

androidSdk ="$System.env.ANDROID_HOME"

      

he delivered "null". Although I set variable ANDROID_HOME and if I checked unter console

echo $ANDROID_HOME 

      

he delivered the right path.

Has anyone installed ANDROID_HOME or something like this on gradle


ADDED:

My problems: why $ System.env.ANDROID_HOME = null when on the terminal "echo $ ANDROID_HOME" gives the correct path?

+3


source to share


2 answers


The terminal uses:

set ANDROID_HOME=/my_current_way_to_sdk ; export ANDROID_HOME

      



Then, you need to start Eclipse, Android Studio, INSIDE, the same terminal. Don't exit, don't open another terminal, etc. If you don't change your .profile, ALWAYS do the above line.

Or - create a wrapper script to do the above set / export and then immediately start whatever you are trying to run.

+1


source


Using:

set ANDROID_HOME = / my_current_way_to / sdk



To do this, you need to use the console.

0


source







All Articles