title: Android SDK on Alpine - adb No such file or directory
body: <p>I'm trying to build an Alpine image containing the Android SDK - specifically, the <code>platform-tools</code> package.</p>
  
  <p>My Dockerfile does the following:</p>
  
  <ol>
  <li>Installs Java and sets <code>JAVA_HOME</code> (needed for Android).</li>
  <li>Downloads the Android SDK tools from Google.</li>
  <li>Unzips the package.</li>
  <li>Sets <code>ANDROID_HOME</code>. Also sets <code>PATH</code> so the <code>sdkmanager</code> executable can be used.</li>
  <li>Installs <code>platform-tools</code> using <code>sdkmanager</code>.</li>
  <li>Adds <code>platform-tools</code> to <code>PATH</code>.</li>
  </ol>
  
  <p><code>platform-tools</code> contains an executable named <code>adb</code>, but for some reason it cannot be seen. Running <code>adb</code> returns:</p>
  
  <pre><code>bash: /android-sdk/platform-tools/adb: No such file or directory
  </code></pre>
  
  <p>Here is my Dockerfile:</p>
  
  <pre><code>FROM alpine:latest
  
  # Install bash and java
  RUN apk update
  RUN apk add bash openjdk8
  ENV JAVA_HOME=/usr/lib/jvm/java-1.8-openjdk
  ENV PATH="$PATH:$JAVA_HOME/bin"
  
  # Download Android SDK and set PATH
  RUN mkdir /android-sdk
  RUN wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip &amp;&amp; unzip *.zip -d /android-sdk &amp;&amp; rm *.zip
  ENV ANDROID_HOME="/android-sdk"
  ENV PATH="$PATH:$ANDROID_HOME/tools/bin"
  
  # Install platform-tools
  RUN yes | sdkmanager "platform-tools"
  ENV PATH="$PATH:$ANDROID_HOME/platform-tools"
  RUN adb version # throws error: adb not found
  </code></pre>
  
  <p>I've looked at <a href="https://stackoverflow.com/questions/13571145/android-adb-not-found">this question</a> but the problem should be fixed with platform-tools v24.0 and higher.</p>