Use below code to read Android_Home path which you have setup in your System.
public
static String getAndroidPath() {
String androidHome = null;
Map env =
System.getenv();
for (String envName : env.keySet()) {
if
(envName.equals("ANDROID_HOME"))
androidHome =
env.get(envName);
}
if (androidHome.equals(null))
throw new NullPointerException(
"Android Home path not
set in machine");
return androidHome;
}