Road to capture Android Home path from system env

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;

No comments:

Post a Comment

Leave your comments, queries, suggestion I will try to provide solution