Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle get System environment variables

Tags:

android

gradle

On mac if i use this under gradle:

androidSdk ="$System.env.HOME"

it delivered an output: /Users/MyName/

and:

androidSdk ="$System.env.ANDROID_HOME"

it delivered 'null'. Altough i've set the ANDROID_HOME Variable and if i checked unter console

echo $ANDROID_HOME 

it delivered the right path.

Have anyone ever set ANDROID_HOME or something like this on gradle


ADDED:

My problems is, why $System.env.ANDROID_HOME = null, when on terminal "echo $ANDROID_HOME" give the right path??

like image 434
Ivancodescratch Avatar asked Feb 27 '26 07:02

Ivancodescratch


1 Answers

In terminal use:

set ANDROID_HOME=/my_current_way_to_sdk ; export ANDROID_HOME

THEN, you need to run Eclipse, Android Studio, INSIDE that same terminal. Do not exit, do not open another terminal, etc. Unless you change your .profile to ALWAYS do the above line.

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

like image 128
TDU Avatar answered Feb 28 '26 20:02

TDU