src/main/java/com/simpligility/maven/plugins/android/AbstractAndroidMojo.java
protected AndroidSdk getAndroidSdk() throws MojoExecutionException
    {
        File chosenSdkPath;
        String chosenSdkPlatform;
        String buildToolsVersion = null;

        if ( sdk != null )
        {
            // An <sdk> tag exists in the pom.
            buildToolsVersion = sdk.getBuildTools();

            if ( sdk.getPath() != null )
            {
                // An <sdk><path> tag is set in the pom.

                chosenSdkPath = sdk.getPath();
            }
            else
            {
                // There is no <sdk><path> tag in the pom.

                if ( sdkPath != null )
                {
                    // -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                    chosenSdkPath = sdkPath;
                }
                else
                {
                    // No -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                    chosenSdkPath = new File( getAndroidHomeOrThrow() );
                }
            }

            // Use <sdk><platform> from pom if it's there, otherwise try -Dandroid.sdk.platform from command line or
            // <properties><sdk.platform>...
            if ( ! isBlank( sdk.getPlatform() ) )
            {
                chosenSdkPlatform = sdk.getPlatform();
            }
            else
            {
                chosenSdkPlatform = sdkPlatform;
            }
        }
        else
        {
            // There is no <sdk> tag in the pom.

            if ( sdkPath != null )
            {
                // -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                chosenSdkPath = sdkPath;
            }
            else
            {
                // No -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                chosenSdkPath = new File( getAndroidHomeOrThrow() );
            }

            // Use any -Dandroid.sdk.platform from command line or <properties><sdk.platform>...
            chosenSdkPlatform = sdkPlatform;
        }

        return new AndroidSdk( chosenSdkPath, chosenSdkPlatform, buildToolsVersion );
    }
protected AndroidSdk getAndroidSdk() throws MojoExecutionException
    {
        File chosenSdkPath;
        String chosenSdkPlatform;
        String buildToolsVersion = null;

        if ( sdk != null )
        {
            // An <sdk> tag exists in the pom.
            buildToolsVersion = sdk.getBuildTools();

            if ( sdk.getPath() != null )
            {
                // An <sdk><path> tag is set in the pom.

                chosenSdkPath = sdk.getPath();
            }
            else
            {
                // There is no <sdk><path> tag in the pom.

                if ( sdkPath != null )
                {
                    // -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                    chosenSdkPath = sdkPath;
                }
                else
                {
                    // No -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                    chosenSdkPath = new File( getAndroidHomeOrThrow() );
                }
            }

            // Use <sdk><platform> from pom if it's there, otherwise try -Dandroid.sdk.platform from command line or
            // <properties><sdk.platform>...
            if ( ! isBlank( sdk.getPlatform() ) )
            {
                chosenSdkPlatform = sdk.getPlatform();
            }
            else
            {
                chosenSdkPlatform = sdkPlatform;
            }
        }
        else
        {
            // There is no <sdk> tag in the pom.

            if ( sdkPath != null )
            {
                // -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                chosenSdkPath = sdkPath;
            }
            else
            {
                // No -Dandroid.sdk.path is set on command line, or via <properties><android.sdk.path>...
                chosenSdkPath = new File( getAndroidHomeOrThrow() );
            }

            // Use any -Dandroid.sdk.platform from command line or <properties><sdk.platform>...
            chosenSdkPlatform = sdkPlatform;
        }

        return new AndroidSdk( chosenSdkPath, chosenSdkPlatform, buildToolsVersion );
    }
<p>Returns the Android SDK to use.</p>

<p>Current implementation looks for System property <code>android.sdk.path</code>, then
<code>&lt;sdk&gt;&lt;path&gt;</code> configuration in pom, then environment variable <code>ANDROID_HOME</code>.

<p>This is where we collect all logic for how to lookup where it is, and which one to choose. The lookup is
based on available parameters. This method should be the only one you should need to look at to understand how
the Android SDK is chosen, and from where on disk.</p>

@return the Android SDK to use.
@throws org.apache.maven.plugin.MojoExecutionException
if no Android SDK path configuration is available at all.