â ď¸ Setup Android Credentials First
Required: You must save your Android credentials before building release apps.
Konten ini belum tersedia dalam bahasa Anda.
Build and submit Android apps to the Google Play Store using Capgoâs secure cloud infrastructure.
â ď¸ Setup Android Credentials First
Required: You must save your Android credentials before building release apps.
Android builds run in secure Cloudflare sandboxes:
Before building for Android, you need:
npx cap open androidFor release builds, you need a signing keystore:
| Build Type | Keystore Required | Purpose |
|---|---|---|
| Debug | No | Testing only, auto-generated |
| Release | Yes | Play Store submission |
If you donât have a keystore yet, create one:
keytool -genkey -v \ -keystore my-release-key.keystore \ -alias my-key-alias \ -keyalg RSA \ -keysize 2048 \ -validity 10000Answer the prompts:
For release builds, set these credentials:
# Android Signing (Required for release)ANDROID_KEYSTORE_FILE="<base64-encoded-keystore>"KEYSTORE_KEY_ALIAS="my-key-alias"KEYSTORE_KEY_PASSWORD="<key-password>"KEYSTORE_STORE_PASSWORD="<store-password>"
# Play Store Publishing (Optional, for auto-submission)PLAY_CONFIG_JSON="<base64-encoded-service-account-json>"Keystore File:
base64 -i my-release-key.keystore | pbcopyPlay Store Service Account JSON:
base64 -i play-store-service-account.json | pbcopyThe base64 string is now in your clipboard.
To enable automatic Play Store uploads:
Perfect for testing without signing:
npx @capgo/cli@latest build com.example.app \ --platform android \ --build-mode debugThis creates a debug APK that can be installed on any device for testing.
For Play Store submission:
npx @capgo/cli@latest build com.example.app \ --platform android \ --build-mode releaseRequires signing credentials to be configured as environment variables.
name: Build Android App
on: push: branches: [main]
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20'
- name: Install dependencies run: npm ci
- name: Build web assets run: npm run build
- name: Sync Capacitor run: npx cap sync android
- name: Build Android app env: CAPGO_TOKEN: ${{ secrets.CAPGO_TOKEN }} ANDROID_KEYSTORE_FILE: ${{ secrets.ANDROID_KEYSTORE }} KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_ALIAS }} KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }} PLAY_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG }} run: | npx @capgo/cli@latest build ${{ secrets.APP_ID }} \ --platform android \ --build-mode releaseSandbox Initialization (~5 seconds)
Project Setup (~20 seconds)
Gradle Build (2-4 minutes)
Play Store Upload (30 seconds, if configured)
Cleanup (immediate)
Our Android build environment includes:
By default, Capgo builds create:
Typical Android build times:
| Build Type | Average Time |
|---|---|
| Debug | 2-3 minutes |
| Release (no ProGuard) | 3-4 minutes |
| Release (with ProGuard) | 4-6 minutes |
If your app has custom build variants (e.g., staging, production), use build-config:
npx @capgo/cli@latest build com.example.app \ --platform android \ --build-mode release \ --build-config '{"variant":"staging"}'This will build the stagingRelease variant.
For apps with flavor dimensions:
--build-config '{"flavor":"premium","variant":"production"}'This builds the premiumProductionRelease variant.
âKeystore password incorrectâ
âKey alias not foundâ
keytool -list -keystore my-release-key.keystoreâGradle build failedâ
./gradlew assembleReleasebuild.gradleâPlay Store upload failedâ
âBuild timeoutâ
Watch for these key phases in the build logs:
â Downloading dependencies...â Running Gradle assembleRelease...â Signing APK/AAB...â Uploading to Play Store...â Build succeededIf a build fails, the specific Gradle error will be shown in the logs.
Always ensure your Android build works locally:
cd android./gradlew assembleRelease# or./gradlew bundleReleaseCapgo reads version from your capacitor.config.json:
{ "appId": "com.example.app", "appName": "My App", "version": "1.0.0", "build": "1"}Increment the build number for each release.
For release builds, ensure ProGuard rules are properly configured:
-keep class com.getcapacitor.** { *; }-keep @com.getcapacitor.annotation.CapacitorPlugin public class * { @com.getcapacitor.annotation.PluginMethod public <methods>;}Keep an eye on APK/AAB size to ensure itâs optimized:
The CLI shows final size:â APK size: 12.4 MBIf your app is large (>50 MB), consider:
With PLAY_CONFIG_JSON configured, builds are automatically uploaded to Play Consoleâs internal testing track.
If you prefer manual submission: