This guide explains the "Why" and "How" of this project's architecture, specifically tailored for DevOps interview preparation.
Question: "How do you ensure consistent builds across different developer machines and CI servers?" Answer: "By containerizing the build environment. I use Docker to define the exact version of the JDK, Android SDK, and Build Tools. This verifies that 'it works on my machine' means it works everywhere."
FROM eclipse-temurin:17-jdk: We start with a stable, lightweight Java base image.ENV ANDROID_HOME: We adhere to standard conventions for SDK location.sdkmanager: We programmatically install specific SDK versions (platform-34) matching ourbuild.gradleconfig.
Question: "Describe your CI/CD strategy for mobile apps." Answer: "I implement a branching strategy where feature branches trigger flexible debug builds for rapid feedback, while the main branch triggers strict production/release builds."
We use shell scripting within the workflow to determine the build target dynamically:
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
# Production: Build Release
echo "TASK=assembleRelease" >> $GITHUB_OUTPUT
else
# Development: Build Debug
echo "TASK=assembleDebug" >> $GITHUB_OUTPUT
fiThe build runs inside the Docker container:
docker run --rm -v $(pwd):/app ... ./gradlew $TASKThis ensures the CI runner's pre-installed tools don't interfere with our build.
We use actions/upload-artifact to save the correct APK (app-debug.apk or app-release-unsigned.apk) allowing QA teams to download and test immediately without access to the code.
Question: "What files do you need to configure in an Android project?" Answer:
app/build.gradle: Defines the compileSdk (must match Dockerfile) and versionCode (should be auto-incremented in CI).gradle.properties: Controls build performance (JVM args) and library compatibility (android.useAndroidX=true).local.properties: IGNORED by git. Used for local SDK paths. In CI, we use environment variables instead.
- "Gradle not found": Often means the wrapper script (
gradlew) relies on a system gradle that isn't installed. Fix: Install Gradle in the Docker image or use the wrapper correctly. - "Permission denied":
gradlewscript often loses executable permission in git. Fix:chmod +x gradleworgit update-index --chmod=+x. - "License not accepted": The Android SDK requires explicit license acceptance. Fix: Run
yes | sdkmanager --licensesin the Dockerfile.