I'm trying to build an Alpine image containing the Android SDK - specifically, the platform-tools
package.
My Dockerfile does the following:
- Installs Java and sets
JAVA_HOME
(needed for Android). - Downloads the Android SDK tools from Google.
- Unzips the package.
- Sets
ANDROID_HOME
. Also setsPATH
so thesdkmanager
executable can be used. - Installs
platform-tools
usingsdkmanager
. - Adds
platform-tools
toPATH
.
platform-tools
contains an executable named adb
, but for some reason it cannot be seen. Running adb
returns:
bash: /android-sdk/platform-tools/adb: No such file or directory
Here is my Dockerfile:
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 && unzip *.zip -d /android-sdk && 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
I've looked at this question but the problem should be fixed with platform-tools v24.0 and higher.