Skip to content

Commit a8ebdb4

Browse files
Update Dockerfile to install Android SDK conditionally
1 parent 9bc0661 commit a8ebdb4

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,19 @@ ENV PATH="${PATH}:${GRADLE_HOME}/bin"
5555
# Skipped when built by devcontainer. handled by the android-sdk feature instead.
5656
# Only install Android SDK if ANDROID_HOME is set (skipped in devcontainers where the android-sdk feature handles this).
5757
RUN if [ -n "${ANDROID_HOME}" ] && [ "$DEVCONTAINER" != "true" ]; then \
58+
mkdir -p ${ANDROID_HOME}/cmdline-tools \
59+
&& cd ${ANDROID_HOME}/cmdline-tools \
60+
&& wget -q "https://dl.google.com/android/repository/commandlinetools-linux-${CMDLINE_TOOLS_VERSION}_latest.zip" -O cmdline-tools.zip \
61+
&& unzip -q cmdline-tools.zip \
62+
&& rm cmdline-tools.zip \
63+
&& mv cmdline-tools latest \
64+
&& yes | ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --licenses 2>/dev/null || true \
65+
&& ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --update \
66+
&& ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager \
67+
"platform-tools" \
68+
"platforms;android-${ANDROID_PLATFORM}" \
69+
"build-tools;${ANDROID_BUILD_TOOLS}"; \
70+
fi
5871

5972
WORKDIR /workspaces/acode
6073

0 commit comments

Comments
 (0)