Failed to find target with hash string 'android-25', though android-25 is actually installed
<p>I have a Ubuntu Xenial VM running in OpenStack, there I've downloaded the latest Android SDK tools ( <strong><em><a href="https://dl.google.com/android/repository/tools_r25.2.3-linux.zip" rel="noreferrer">tools_r25.2.3-linux.zip</a></em></strong> ) from <a href="https://developer.android.com/studio/index.html" rel="noreferrer">https://developer.android.com/studio/index.html</a>.  And everything is well configured:</p>

<ul>
<li><code>JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64</code></li>
<li><code>ANDROID_HOME=&lt;ANDROID_SDK_PATH&gt;</code></li>
<li><code>PATH=${PATH}:${ANDROID_HOME}</code></li>
<li><code>echo "sdk.dir=&lt;ANDROID_SDK_PATH&gt;" &gt; &lt;MY_ANDROID_PROJECT_PATH&gt;/local.properties</code></li>
</ul>

<p>But when try to execute task: <code>./gradlew clean</code>, error occurs:</p>

<pre><code>Preparing "Install Android SDK Build-Tools 25".
Warning: Trying to install into ${ANDROID_HOME}/build-tools/25.0.0/ but package "Android SDK Tools 25.2.4" already exists at ${ANDROID_HOME}. It must be deleted or moved away before installing into a child directory.
Preparing "Install Android SDK Platform 25".
Warning: Trying to install into ${ANDROID_HOME}/platforms/android-25/ but package "Android SDK Tools 25.2.4" already exists at ${ANDROID_HOME}. It must be deleted or moved away before installing into a child directory.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':demo'.
&gt; Failed to install the following SDK components:
  [Android SDK Build-Tools 25, Android SDK Platform 25]
  Please install the missing components using the SDK manager in Android Studio.
</code></pre>

<p>And actually as the error log mentions, I have the required tools installed.  Run <code>$ANDROID_HOME/bin/sdkmanager --list</code> shows my installed packages:</p>

<pre><code>Installed packages:
  Path                        | Version | Description                       | Location
  -------                     | ------- | -------                           | -------
  build-tools;25.0.0          | 25.0.0  | Android SDK Build-Tools 25        | build-tools/25.0.0/
  extras;android;m2repository | 41.0.0  | Android Support Repository, re... | extras/android/m2repository/
  platform-tools              | 25.0.2  | Android SDK Platform-Tools 25.0.2 | platform-tools/
  platforms;android-25        | 3       | Android SDK Platform 25, rev 3    | platforms/android-25/
  tools                       | 25.2.4  | Android SDK Tools 25.2.4          | tools/
</code></pre>

<p>What could be wrong here?  I'm a bit suspicious of the SDK path here.</p>