Android Quickstart
Set up Gradle builds, test runs, and Play Store uploads with shipit.
On this page
Android Quickstart
Get your first Android build shipped with ShipItSwifty.
Prerequisites
- Xcode CLI tools or Homebrew (
swift,swift build) - An Android project with a
gradlewwrapper at the project root - A Google Play service account JSON key (for Play Store uploads)
bundletoolon PATH (forvalidate bundle:brew install bundletool)
1. Install ShipItSwifty
# From source
git clone https://github.com/shipitswifty/shipitswifty
cd shipitswifty
git checkout 0.1.0
swift build -c release
cp .build/release/shipit /usr/local/bin/shipit2. Auto-detect your project
Run generate from your Android project root. ShipItSwifty detects gradlew, walks through the missing values, and writes an Android-ready Shipfile.yml:
cd /path/to/MyAndroidApp
shipit generate --goal beta --platform androidThe generated setup includes:
- Detected platform (
.android) - Required secrets (
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON) - A ready-to-use
Shipfile.ymldraft - The next recommended command
3. Create a Shipfile
shipit generate --goal beta --platform android --non-interactive --output jsonOr write one manually:
# Shipfile.yml
platform: android
android:
module: app
build_variant: release
package_name: com.example.myapp
play_track: internal
keystore_path: ./certs/release.keystore
keystore_password: ${ANDROID_KEYSTORE_PASSWORD}
key_alias: release
key_password: ${ANDROID_KEY_PASSWORD}
workflows:
beta:
steps:
- action: test
- action: archive
- action: validate_bundle
- action: play_store4. Set credentials
export ANDROID_KEYSTORE_PASSWORD=...
export ANDROID_KEY_PASSWORD=...
export GOOGLE_PLAY_SERVICE_ACCOUNT_JSON="$(cat service-account.json)"5. Run a dry-run
shipit run beta --dry-run --output json6. Ship it
shipit run beta --ci --output jsonIndividual commands
# Build APK
shipit build --platform android
# Run unit tests
shipit test --platform android
# Build AAB
shipit archive --platform android
# Run lint
shipit lint --platform android
# Validate the AAB before uploading
shipit validate bundle --bundle ./app/build/outputs/bundle/release/app-release.aab
# Upload to Google Play
shipit play-store --platform androidPlatform auto-detection
When --platform is omitted, ShipItSwifty checks the current directory:
| File found | Detected platform |
|---|---|
gradlew or build.gradle.kts | Android |
*.xcworkspace or *.xcodeproj | iOS |
| (nothing) | iOS (default) |
Google Play service account setup
Use these values for Android setup:
| Value | Where to find it |
|---|---|
package_name | Your Android application ID, usually applicationId in app/build.gradle or app/build.gradle.kts (for example com.example.myapp) |
play_track | The Play Console release track you want to target: typically internal, alpha, beta, or production |
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON | Raw contents of the service account key JSON file |
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_PATH | Local filesystem path to that JSON key file |
Set up Play API access:
- Open Google Cloud Console and create or choose a project.
- Enable the
Google Play Developer APIfor that project. - Create a service account in that Google Cloud project.
- Create and download a JSON key for that service account.
- Open Google Play Console ->
Users and permissions. - Invite the service account email address as a user.
- Grant the permissions needed for your target track.
Typical permissions:
View app information (read-only)so the account can read app stateRelease apps to testing tracksforinternal,alpha, orbetaRelease to production, exclude devices, and use Play App Signingif you want production rollout
Then set one of these:
export GOOGLE_PLAY_SERVICE_ACCOUNT_JSON="$(cat service-account.json)"
# or
export GOOGLE_PLAY_SERVICE_ACCOUNT_JSON_PATH=./service-account.jsonNotes:
shipit generate --platform androidcan usually inferpackage_name, but the source of truth is your GradleapplicationId.play_trackmust match the kind of release you intend to publish. For early testing, start withinternal.
Troubleshooting
gradlew: Permission denied
chmod +x ./gradlewbundletool: command not found
brew install bundletoolGoogle Play upload failed: 401
Check that your service account has the Release Manager role in Google Play Console (not just Google Cloud Console).
Build uses gradle instead of ./gradlew
ShipItSwifty uses ./gradlew when it exists in the working directory or the configured gradlew_path. If neither is present, it falls back to gradle on PATH. Set android.gradlew_path in Shipfile.yml to override.