Skip to content

Quick Start - Android

This guide walks you through setting up a RunnerHub pipeline for Android projects. Build, test, and deploy your Android app with automated dependency caching and integrated code signing support.

Create .runnerhub/runnerhub.yml in your repository root:

name: Android Build
platform: android
environment:
android_sdk: 34
triggers:
- push
- pull_request
steps:
- name: Build APK
run: ./gradlew assembleDebug

This pipeline builds a debug APK using Gradle.

Expand your pipeline to include dependency resolution and tests:

name: Android Build
platform: android
environment:
android_sdk: 34
triggers:
- push
- pull_request
steps:
- name: Install dependencies
run: ./gradlew dependencies
- name: Run tests
run: ./gradlew test
- name: Build APK
run: ./gradlew assembleDebug
artifacts:
- app/build/outputs/**/*.apk
  1. Commit and push .runnerhub/runnerhub.yml to your repository
  2. Go to app.runnerhub.net and navigate to your app
  3. Watch your Android build run in the dashboard

For Google Play distribution, build a release APK:

name: Android Release Build
platform: android
environment:
android_sdk: 34
triggers:
- push
steps:
- name: Build Release APK
run: ./gradlew assembleRelease
artifacts:
- app/build/outputs/**/*.apk

Build an App Bundle (AAB) for distribution via Google Play:

name: Android App Bundle
platform: android
environment:
android_sdk: 34
triggers:
- push
steps:
- name: Build AAB
run: ./gradlew bundleRelease
artifacts:
- app/build/outputs/**/*.aab

Here’s a comprehensive pipeline with code analysis:

name: Android Build & Test
platform: android
environment:
android_sdk: 34
triggers:
- push
- pull_request
steps:
- name: Run linting
run: ./gradlew lint
- name: Run unit tests
run: ./gradlew testDebugUnitTest
- name: Build APK
run: ./gradlew assembleDebug
- name: Build test APK
run: ./gradlew assembleDebugAndroidTest
artifacts:
- app/build/outputs/**/*.apk

RunnerHub automatically caches common dependency managers including Gradle (~/.gradle/caches and ~/.gradle/wrapper), CocoaPods, SPM, npm, yarn, and gems. Gradle caches are restored between builds automatically, keyed on build.gradle*, settings.gradle*, and gradle-wrapper.properties.

If you need to sign your release build, use environment variables:

name: Android Signed Release
platform: android
environment:
android_sdk: 34
triggers:
- push
steps:
- name: Build signed APK
run: ./gradlew assembleRelease
env:
KEYSTORE_PATH: $KEYSTORE_PATH
KEY_ALIAS: $KEY_ALIAS
KEYSTORE_PASSWORD: $KEYSTORE_PASSWORD
KEY_PASSWORD: $KEY_PASSWORD
artifacts:
- app/build/outputs/**/*.apk

Update your build.gradle to use these environment variables for signing.

Run on-device or emulator tests:

name: Android Instrumentation Tests
platform: android
environment:
android_sdk: 34
triggers:
- push
- pull_request
steps:
- name: Run tests
run: ./gradlew connectedAndroidTest

If your project uses build flavors:

name: Android Multi-Flavor Build
platform: android
environment:
android_sdk: 34
triggers:
- push
- pull_request
steps:
- name: Build Production Debug
run: ./gradlew assembleProdDebug
- name: Build Staging Debug
run: ./gradlew assembleStagingDebug
- name: Build Dev Release
run: ./gradlew assembleDevRelease
artifacts:
- app/build/outputs/**/*.apk

If your Android project is in a subdirectory:

name: Android Monorepo Build
platform: android
environment:
android_sdk: 34
triggers:
- push
- pull_request
steps:
- name: Build APK
run: ./gradlew assembleDebug
working_directory: apps/android

Make gradle executable:

- name: Setup
run: chmod +x ./gradlew

Clear Gradle cache:

- name: Clean build
run: ./gradlew clean assembleDebug

Check Gradle tasks:

- name: List tasks
run: ./gradlew tasks

View build configuration:

- name: Debug build
run: ./gradlew assemble --info

Add secrets and API keys via the dashboard:

steps:
- name: Build
run: ./gradlew assembleRelease
env:
GOOGLE_PLAY_KEY: $GOOGLE_PLAY_KEY
API_BASE_URL: $API_BASE_URL

Update your build.gradle or local.properties to use these variables.