# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p $ANDROID_SDK_ROOT/cmdline-tools && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d $ANDROID_SDK_ROOT/cmdline-tools && \
rm /tmp/commandlinetools-linux.zip && \
yes | $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" && \
yes | $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Update PATH to include Android tools and Flutter
ENV PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools"
# Install Flutter SDK (stable) into /opt/flutter
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
ENV PATH="/opt/flutter/bin:${PATH}"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Create local.properties for Flutter Gradle plugin to locate Flutter SDK
RUN bash -lc 'echo "flutter.sdk=/opt/flutter" > local.properties'
# Build the Android app (Flutter-enabled) from source
RUN bash -lc "cd android && ./gradlew clean && ./gradlew assembleDebug"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
# Docker ignore file for Karing project .git .gradle build android/build **/build **/out *.log *.class *.jar *.aar *.apk *.aab .idea .vscode *.iml local.properties *.keystore *.DS_Store */flutter/bin/cache
- Build status: build_failed
- Concerns
- Potential misplacement of local.properties: flutter.sdk=/opt/flutter created at /workspace/local.properties; Flutter Gradle plugin expects local.properties inside android/ to locate the Flutter SDK.
- FROM image tag ubuntu:jammy-20260217 may not exist on Docker Hub; verify tag or switch to a standard tag (e.g., ubuntu:22.04).
- Building/wiring Flutter/Android SDK in a single image is heavy; consider multi-stage builds or separated steps.
- Build error
- Exact error messages and exit code:
- /bin/sh: 1: /usr/local/android-sdk/cmdline-tools/tools/bin/sdkmanager: not found
- Exit code: 127
- Failing command/step:
- The RUN in the Dockerfile that downloads and installs Android command-line tools:
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux_9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d $ANDROID_SDK_ROOT/cmdline-tools && \
rm /tmp/commandlinetools-linux.zip && \
yes | $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" && \
yes | $ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
- Missing packages/files:
- sdkmanager binary not found at the path used: /usr/local/android-sdk/cmdline-tools/tools/bin/sdkmanager
- Actual extracted layout contains: /usr/local/android-sdk/cmdline-tools/cmdline-tools/bin/sdkmanager
- Version/layout mismatch:
- Archive unpacks to: /usr/local/android-sdk/cmdline-tools/cmdline-tools/bin/sdkmanager
- Dockerfile expects: /usr/local/android-sdk/cmdline-tools/tools/bin/sdkmanager
- Cause: tool-layout/version change; fix by adjusting to cmdline-tools/bin/sdkmanager or adding a symlink to tools/bin/sdkmanager.# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && \
rm /tmp/commandlinetools-linux.zip && \
# Some layouts place sdkmanager at cmdline-tools/cmdline-tools/bin/sdkmanager or tools/bin/sdkmanager
if [ -f "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager" ]; then \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager"; \
else \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager"; \
fi && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Update PATH to include Android tools and Flutter
ENV PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools"
# Install Flutter SDK (stable) into /opt/flutter
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
ENV PATH="/opt/flutter/bin:${PATH}"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Ensure android/local.properties exists for Gradle to locate Flutter SDK
RUN bash -lc 'if [ ! -f android/local.properties ]; then echo "sdk.dir=/usr/local/android-sdk" > android/local.properties; echo "flutter.sdk=/opt/flutter" >> android/local.properties; fi'
# Build the Android app (Flutter-enabled) from source
RUN bash -lc "cd android && ./gradlew clean && ./gradlew assembleDebug"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
- Exact error message and exit code:
- bash: line 1: ./gradlew: No such file or directory
- Exit code: 127
- Failing command/step:
- [8/8] RUN bash -lc "cd android && ./gradlew clean && ./gradlew assembleDebug"
- Missing packages or files mentioned:
- gradlew (the Gradle wrapper) is missing in the android/ directory; the command cannot execute ./gradlew, resulting in “No such file or directory”.
- Version mismatch info (from log):
- Base image: ubuntu: jammy-20260217
- Android SDK components downloaded during build (partial):
- platform-tools: r37.0.0
- Android platform: 34
- Build-tools: r34
- NDK: r26d (26.3.11579264)
- Flutter repo cloned from stable branch into /opt/flutter
- No explicit Gradle wrapper/version mismatch shown; the failure is due to the missing gradlew file rather than a version incompatibility.# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && \
rm /tmp/commandlinetools-linux.zip && \
# Some layouts place sdkmanager at cmdline-tools/cmdline-tools/bin/sdkmanager or tools/bin/sdkmanager
if [ -f "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager" ]; then \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager"; \
else \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager"; \
fi && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Update PATH to include Android tools and Flutter
ENV PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools"
# Install Flutter SDK (stable) into /opt/flutter
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
ENV PATH="/opt/flutter/bin:${PATH}"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Ensure android/local.properties exists for Flutter Gradle plugin to locate Flutter SDK
RUN bash -lc 'if [ ! -f android/local.properties ]; then echo "flutter.sdk=/opt/flutter" > android/local.properties; echo "sdk.dir=/usr/local/android-sdk" >> android/local.properties; fi'
# Build the Android app (Flutter-enabled) from source
RUN bash -lc "cd android && if [ -x ./gradlew ]; then ./gradlew clean && ./gradlew assembleDebug; else echo 'gradlew not found, attempting to use system Gradle'; apt-get update -y && apt-get install -y --no-install-recommends gradle; gradle clean; gradle assembleDebug; fi"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
- VerifyBuild status: build_failed
- Concerns
- FROM image tag 'ubuntu:jammy-20260217' may be a non-official tag and could be brittle for future builds.
- Build relies on network access to fetch Android SDK components and Flutter; ensure build environments have stable network access.
- APK output path may vary with Gradle/Flutter versions; smoke tests should account for possible different APK locations.
- Build error (actionable)
- Exact error and exit: Exit code: 1; BUILD FAILED in 0s
- Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
- > Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
- Repeats:
- Could not create service of type ScriptPluginFactory using BuildScopeServices.createScriptPluginFactory().
- > Could not create service of type PluginResolutionStrategyInternal using BuildScopeServices.createPluginResolutionStrategy().
- Failing command / step
- Step: [8/8] RUN bash -lc "cd android && if [ -x ./gradlew ]; then ./gradlew clean && ./gradlew assembleDebug; else echo 'gradlew not found, attempting to use system Gradle'; apt-get update -y && apt-get install -y --no-install-recommends gradle; gradle clean; gradle assembleDebug; fi"
- This is the command that did not complete successfully (exit code 1).
- Missing packages or files mentioned
- gradlew not found (gradle wrapper not present): "gradlew not found, attempting to use system Gradle"
- The container then installs system Gradle (via apt), but the failure occurs during the Gradle run.
- Version mismatch / environment details
- Java environment: OpenJDK 17 is installed (from apt-get install: build-essential, openjdk-17-jdk, etc.).
- Gradle version used (installed via apt): Gradle 4.4.1 (package gradle 4.4.1-13).
- Implication: The project’s Gradle setup (and likely the Gradle wrapper) is not aligned with Java 17; the old system Gradle 4.4.1 is generally incompatible with modern Gradle plugins and Android builds.
- Notes / quick context
- Android build is invoked via Gradle in the android directory: assembleDebug.
- The failure arises when attempting to use the system Gradle due to the missing wrapper, then fails during Gradle initialization with ScriptPluginFactory/PluginResolutionStrategyInternal service creation errors.# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && \
rm /tmp/commandlinetools-linux.zip && \
# Some layouts place sdkmanager at cmdline-tools/cmdline-tools/bin/sdkmanager or tools/bin/sdkmanager
if [ -f "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager" ]; then \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager"; \
else \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager"; \
fi && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Install Gradle (system Gradle 8.x compatible with AGP 8+)
RUN curl -o /tmp/gradle-8.14.3-all.zip -L https://services.gradle.org/distributions/gradle-8.14.3-all.zip && \
mkdir -p /opt/gradle-8.14.3 && \
unzip -d /opt/gradle-8.14.3 /tmp/gradle-8.14.3-all.zip && \
rm /tmp/gradle-8.14.3-all.zip
# Flutter SDK (stable) installation
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
# Update PATH to include Android tools, Gradle, and Flutter
ENV PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:/platform-tools:/opt/gradle-8.14.3/bin:/opt/flutter/bin"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Ensure android/local.properties exists for Flutter Gradle plugin to locate Flutter SDK
RUN bash -lc 'if [ ! -f android/local.properties ]; then mkdir -p android && echo "flutter.sdk=/opt/flutter" > android/local.properties; echo "sdk.dir=/usr/local/android-sdk" >> android/local.properties; fi'
# Build the Android app (Gradle-based) from source using system Gradle
RUN bash -lc "cd android && /opt/gradle-8.14.3/bin/gradle clean && /opt/gradle-8.14.3/bin/gradle assembleDebug"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
Status
- VerifyBuild status: build_failed
Key concerns
- PATH issue: PATH contains an incorrect /platform-tools path; should be $ANDROID_SDK_ROOT/platform-tools; may affect command lookup.
- Android module: Build relies on an android module in the repo; if absent, image build may fail.
- Flutter SDK: Installed but not used in build; increases image size; remove if not needed.
Build steps and actionable items
- Base: docker driver, building with default instance
- Image: ubuntu:jammy-20260217
- Installed packages (via apt-get -y): curl, unzip, git, ca-certificates, build-essential, openjdk-17-jdk, zip, lib32stdc++6
- Android SDK setup (RUN step 3/9):
- Create: /usr/local/android-sdk/cmdline-tools
- Download: /tmp/commandlinetools-linux.zip from https://dl.google.com/android/repository/commandlinetools-linux_9477386_latest.zip
- Unzip: to /usr/local/android-sdk/cmdline-tools
- SDKMANAGER path check:
- /usr/local/android-sdk/cmdline-tools/cmdline-tools/bin/sdkmanager
- or /usr/local/android-sdk/cmdline-tools/tools/bin/sdkmanager
- Install via sdkmanager: platform-tools, platforms;android-34, build-tools;34.0.0, ndk;26.3.11579264
- Gradle setup (RUN step 4/9, truncated in log):
- Download: /tmp/gradle-8.14.3-all.zip from services.gradle.org
- Create: /opt/gradle-8.14.3
- Unzip: into /opt/gradle-8.14.3
- Partial log shows: "rm /tmp/grad" (truncated)
- Build context: transferred (162.57kB), with several steps marked CACHED
Notes for next steps
- Verify repository contains an android module (since missing module can break image build).
- Ensure ANDROID_SDK_ROOT and PATH align with the installed Android components.
- If Flutter isn’t required, remove Flutter-related steps to reduce image size.
- Check the remainder of the log after the truncated portion to identify the exact failure cause (likely related to Gradle or Android tooling).No matches found.
# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && \
rm /tmp/commandlinetools-linux.zip && \
# Some layouts place sdkmanager at cmdline-tools/cmdline-tools/bin/sdkmanager or tools/bin/sdkmanager
if [ -f "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager" ]; then \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager"; \
else \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager"; \
fi && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Install Gradle (system Gradle 8.x compatible with AGP 8+)
RUN curl -o /tmp/gradle-8.14.3-all.zip -L https://services.gradle.org/distributions/gradle-8.14.3-all.zip && \
mkdir -p /opt/gradle-8.14.3 && \
unzip -d /opt/gradle-8.14.3 /tmp/gradle-8.14.3-all.zip && \
rm /tmp/gradle-8.14.3-all.zip
# Flutter SDK (stable) installation
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
# Update PATH to include Android tools, Gradle, and Flutter
ENV PATH="$PATH:$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools:/opt/gradle-8.14.3/bin:/opt/flutter/bin"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Ensure android/local.properties exists for Flutter Gradle plugin to locate Flutter SDK
RUN bash -lc 'if [ ! -f android/local.properties ]; then mkdir -p android && echo "flutter.sdk=/opt/flutter" > android/local.properties; echo "sdk.dir=/usr/local/android-sdk" >> android/local.properties; fi'
# Build the Android app (Gradle-based) from source using system Gradle
RUN bash -lc "cd android && /opt/gradle-8.14.3/bin/gradle clean && /opt/gradle-8.14.3/bin/gradle assembleDebug"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
Failing step: - [9/9] RUN bash -lc "cd android && /opt/gradle-8.14.3/bin/gradle clean && /opt/gradle-8.14.3/bin/gradle assembleDebug" Exact error message and exit code: - bash: line 1: /opt/gradle-8.14.3/bin/gradle: No such file or directory - exit code: 127 Description of failure: - The build attempted to run the Gradle binary at /opt/gradle-8.14.3/bin/gradle, but the file does not exist. Missing packages or files mentioned: - /opt/gradle-8.14.3/bin/gradle (Gradle binary missing at the expected path) Version information: - Gradle distribution referenced: gradle-8.14.3-all.zip - Extracted to: /opt/gradle-8.14.3 - Build then tries to run /opt/gradle-8.14.3/bin/gradle (missing despite the distribution being downloaded).
# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && \
rm /tmp/commandlinetools-linux.zip && \
# Some layouts place sdkmanager at cmdline-tools/cmdline-tools/bin/sdkmanager or tools/bin/sdkmanager
if [ -f "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager" ]; then \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager"; \
else \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager"; \
fi && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Install Gradle (system Gradle 8.x compatible with AGP 8+)
RUN curl -o /tmp/gradle-8.14.3-all.zip -L https://services.gradle.org/distributions/gradle-8.14.3-all.zip && \
mkdir -p /opt/gradle-8.14.3 && \
unzip -d /opt/gradle-8.14.3 /tmp/gradle-8.14.3-all.zip && \
rm /tmp/gradle-8.14.3-all.zip
# Flutter SDK (stable) installation
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
# Environment for Gradle and Flutter
ENV GRADLE_VERSION=8.14.3
ENV GRADLE_ROOT=/opt/gradle-8.14.3/gradle-${GRADLE_VERSION}
ENV PATH="$GRADLE_ROOT/bin:$PATH"
# Update PATH to include Android tools, Flutter
ENV ANDROID_TOOLS_PATH="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools"
ENV PATH="$PATH:$ANDROID_TOOLS_PATH:/opt/flutter/bin"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Ensure android/local.properties exists for Flutter Gradle plugin to locate Flutter SDK
RUN bash -lc 'if [ ! -f android/local.properties ]; then mkdir -p android && echo "flutter.sdk=/opt/flutter" > android/local.properties; echo "sdk.dir=/usr/local/android-sdk" >> android/local.properties; fi'
# Build the Android app (Gradle-based) from source using system Gradle
RUN bash -lc "cd android && export _GRADLE_ROOT=$GRADLE_ROOT; $_GRADLE_ROOT/bin/gradle clean && $_GRADLE_ROOT/bin/gradle assembleDebug"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
- Exact error message and exit code - bash: line 1: /bin/gradle: No such file or directory (exit code: 127) - Failing command/step - [9/9] RUN bash -lc "cd android && export _GRADLE_ROOT=/opt/gradle-8.14.3/gradle-8.14.3; $_GRADLE_ROOT/bin/gradle clean && $_GRADLE_ROOT/bin/gradle assembleDebug" - Missing packages or files mentioned - The Gradle executable was not found at the expected path: $_GRADLE_ROOT/bin/gradle (expands to /opt/gradle-8.14.3/gradle-8.14.3/bin/gradle). The error references /bin/gradle, indicating the gradle binary could not be located/executed. - Version mismatch info - Gradle version implied by path: 8.14.3 (no explicit mismatch message in logs). No explicit version mismatch is reported.
# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && \
rm /tmp/commandlinetools-linux.zip && \
# Some layouts place sdkmanager at cmdline-tools/cmdline-tools/bin/sdkmanager or tools/bin/sdkmanager
if [ -f "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager" ]; then \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager"; \
else \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager"; \
fi && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Install Gradle (system Gradle 8.x compatible with AGP 8+)
RUN curl -o /tmp/gradle-8.14.3-all.zip -L https://services.gradle.org/distributions/gradle-8.14.3-all.zip && \
mkdir -p /opt/gradle-8.14.3 && \
unzip -d /opt/gradle-8.14.3 /tmp/gradle-8.14.3-all.zip && \
rm /tmp/gradle-8.14.3-all.zip
# Flutter SDK (stable) installation
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
# Environment for Gradle and Flutter
ENV GRADLE_VERSION=8.14.3
ENV GRADLE_ROOT=/opt/gradle-8.14.3/gradle-${GRADLE_VERSION}
ENV PATH="$GRADLE_ROOT/bin:$PATH"
# Update PATH to include Android tools, Flutter
ENV ANDROID_TOOLS_PATH="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools"
ENV PATH="$PATH:$ANDROID_TOOLS_PATH:/opt/flutter/bin"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Create a gradlew wrapper script in android/ to call the system Gradle, if not present
RUN bash -lc 'if [ ! -f android/gradlew ]; then cat > android/gradlew << "EOF"
#!/bin/bash
/opt/gradle-8.14.3/bin/gradle "$@"
EOF
chmod +x android/gradlew; fi'
# Ensure android/local.properties exists for Flutter Gradle plugin to locate Flutter SDK
RUN bash -lc 'if [ ! -f android/local.properties ]; then mkdir -p android; echo "flutter.sdk=/opt/flutter" > android/local.properties; echo "sdk.dir=/usr/local/android-sdk" >> android/local.properties; fi'
# Build the Android app (Gradle-based) from source using system Gradle
RUN bash -lc "cd android && ./gradlew clean && ./gradlew assembleDebug"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
#0 building with "default" instance using docker driver #1 [internal] load build definition from Dockerfile #1 transferring dockerfile: 3.19kB done #1 DONE 0.0s Dockerfile:62 -------------------- 60 | RUN bash -lc 'if [ ! -f android/gradlew ]; then cat > android/gradlew << "EOF" 61 | #!/bin/bash 62 | >>> /opt/gradle-8.14.3/bin/gradle "$@" 63 | EOF 64 | chmod +x android/gradlew; fi' -------------------- ERROR: failed to build: failed to solve: dockerfile parse error on line 62: unknown instruction: /opt/gradle-8.14.3/bin/gradle
# Dockerfile for building Karing Kotlin/Flutter Android app from source
FROM ubuntu:jammy-20260217
# Non-interactive apt installs
ENV DEBIAN_FRONTEND=noninteractive
# System dependencies (align with runtime_requirements)
RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
curl \
unzip \
git \
ca-certificates \
build-essential \
openjdk-17-jdk \
zip \
lib32stdc++6 \
&& rm -rf /var/lib/apt/lists/*
# Android SDK location
ENV ANDROID_SDK_ROOT=/usr/local/android-sdk
# Install Android command-line tools and platform components
RUN mkdir -p "$ANDROID_SDK_ROOT/cmdline-tools" && \
curl -o /tmp/commandlinetools-linux.zip -L https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip && \
unzip /tmp/commandlinetools-linux.zip -d "$ANDROID_SDK_ROOT/cmdline-tools" && \
rm /tmp/commandlinetools-linux.zip && \
# Detect sdkmanager location and install components
if [ -f "$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager" ]; then \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin/sdkmanager"; \
else \
SDKMANAGER="$ANDROID_SDK_ROOT/cmdline-tools/tools/bin/sdkmanager"; \
fi && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platform-tools" && \
yes | "$SDKMANAGER" --sdk_root="$ANDROID_SDK_ROOT" "platforms;android-34" "build-tools;34.0.0" "ndk;26.3.11579264"
# Install Gradle (system Gradle 8.x compatible with AGP 8+)
RUN curl -o /tmp/gradle-8.14.3-all.zip -L https://services.gradle.org/distributions/gradle-8.14.3-all.zip && \
mkdir -p /opt/gradle-8.14.3 && \
unzip -d /opt/gradle-8.14.3 /tmp/gradle-8.14.3-all.zip && \
rm /tmp/gradle-8.14.3-all.zip
# Flutter SDK (stable) installation
RUN git clone https://github.com/flutter/flutter.git /opt/flutter -b stable
# Environment for Gradle and Flutter
ENV GRADLE_VERSION=8.14.3
ENV GRADLE_ROOT=/opt/gradle-8.14.3/gradle-${GRADLE_VERSION}
ENV PATH="$GRADLE_ROOT/bin:$PATH"
# Update PATH to include Android tools, Flutter
ENV ANDROID_TOOLS_PATH="$ANDROID_SDK_ROOT/cmdline-tools/cmdline-tools/bin:$ANDROID_SDK_ROOT/cmdline-tools/tools/bin:$ANDROID_SDK_ROOT/platform-tools"
ENV PATH="$PATH:$ANDROID_TOOLS_PATH:/opt/flutter/bin"
# Workspace for building the app
WORKDIR /workspace
COPY . .
# Create local.properties for Flutter Gradle plugin to locate Flutter SDK and Android SDK if missing
RUN bash -lc 'if [ ! -f android/local.properties ]; then mkdir -p android; echo "flutter.sdk=/opt/flutter" > android/local.properties; echo "sdk.dir=/usr/local/android-sdk" >> android/local.properties; fi'
# Build the Android app (Gradle-based) from source using system Gradle
RUN bash -lc "cd android && /opt/gradle-8.14.3/bin/gradle clean && /opt/gradle-8.14.3/bin/gradle assembleDebug"
# Default to an interactive shell to inspect the image
CMD ["/bin/bash"]
- Exact error message and exit code: - "bash: line 1: /opt/gradle-8.14.3/bin/gradle: No such file or directory" (exit code 127) - Failing command/step: - RUN bash -lc "cd android && /opt/gradle-8.14.3/bin/gradle clean && /opt/gradle-8.14.3/bin/gradle assembleDebug" - Missing packages or files mentioned: - The Gradle binary at /opt/gradle-8.14.3/bin/gradle does not exist. The Gradle distribution was unpacked to /opt/gradle-8.14.3/gradle-8.14.3/bin/gradle, so the expected path is incorrect. - Version mismatch/info: - Gradle version being used: 8.14.3 (gradle-8.14.3-all.zip). The unzip step extracts to /opt/gradle-8.14.3/gradle-8.14.3/bin/gradle, but the script expects /opt/gradle-8.14.3/bin/gradle, indicating a path mismatch due to directory naming.