How to Build an Android APK or AAB in CI
assembleRelease produces an APK; bundleRelease produces an AAB, the format Google Play requires for new apps.
Provision a JDK with actions/setup-java, then run the Gradle wrapper. Use bundleRelease for a Play upload (.aab) or assembleRelease for a directly installable .apk.
Steps
- Check out the repo and set up a JDK (Temurin 17 for recent Android Gradle Plugin).
- Run
./gradlew bundleRelease(orassembleRelease) from the project root. - Upload the output under
app/build/outputs/as a build artifact.
Workflow
.github/workflows/ci.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- run: chmod +x gradlew && ./gradlew bundleRelease
- uses: actions/upload-artifact@v4
with:
name: app-release-aab
path: app/build/outputs/bundle/release/app-release.aabGotchas
- An unsigned
bundleReleaseproducesapp-release.aabonly if signing is wired; otherwise you getapp-release-unsigned. - Cache the Gradle home to avoid re-downloading dependencies on every run.
Related guides
How to Sign an Android App in CI With a KeystoreSign an Android release in CI by decoding a base64 keystore from a secret into a temp file, passing store and…
How to Cache Gradle and CocoaPods in CISpeed up mobile CI by caching the Gradle home and the CocoaPods Pods directory keyed on the lockfiles, so dep…