85 lines
2.5 KiB
Markdown
85 lines
2.5 KiB
Markdown
# Android Build Scripts
|
|
|
|
Scripts for building, signing, and distributing the Kordant Android app.
|
|
|
|
## Scripts
|
|
|
|
### `generate-release-key.sh`
|
|
Generates a release keystore and configures signing for Google Play.
|
|
|
|
```bash
|
|
chmod +x scripts/generate-release-key.sh
|
|
./scripts/generate-release-key.sh
|
|
```
|
|
|
|
Creates:
|
|
- `kordant-release.keystore` — The keystore file (KEEP SECURE)
|
|
- `key.properties` — Gradle signing credentials (in `.gitignore`)
|
|
|
|
### `build-release-aab.sh`
|
|
Builds a signed Android App Bundle (AAB) for Google Play upload.
|
|
|
|
```bash
|
|
chmod +x scripts/build-release-aab.sh
|
|
./scripts/build-release-aab.sh # prodRelease (default)
|
|
./scripts/build-release-aab.sh --variant=devRelease
|
|
```
|
|
|
|
Requires:
|
|
- `key.properties` configured (copy from `key.properties.template`)
|
|
- Android SDK configured in `local.properties`
|
|
|
|
## Build Variants
|
|
|
|
| Variant | Application ID | API URL | Use Case |
|
|
|---------|---------------|---------|----------|
|
|
| `prodRelease` | `com.kordant.android` | `api.kordant.com` | Google Play production |
|
|
| `devRelease` | `com.kordant.android.dev` | `10.0.2.2:3000` | Internal testing |
|
|
| `prodDebug` | `com.kordant.android.debug` | `api.kordant.com` | Debug with prod config |
|
|
| `devDebug` | `com.kordant.android.dev.debug` | `10.0.2.2:3000` | Development |
|
|
|
|
## Gradle Commands
|
|
|
|
```bash
|
|
# Build release AAB (for Play Store)
|
|
./gradlew bundleProdRelease
|
|
|
|
# Build release APK (for sideloading)
|
|
./gradlew assembleProdRelease
|
|
|
|
# Build debug APK
|
|
./gradlew assembleDevDebug
|
|
|
|
# Run unit tests
|
|
./gradlew test
|
|
|
|
# Run instrumentation tests (requires device/emulator)
|
|
./gradlew connectedAndroidTest
|
|
|
|
# Generate baseline profile (for startup optimization)
|
|
./gradlew baselineProfileProdRelease
|
|
|
|
# Clean build
|
|
./gradlew clean
|
|
```
|
|
|
|
## Output Locations
|
|
|
|
| Build Type | Output Path |
|
|
|------------|-------------|
|
|
| AAB | `app/build/outputs/bundle/prodRelease/app-prod-release.aab` |
|
|
| APK | `app/build/outputs/apk/prod/release/app-prod-release.apk` |
|
|
| Test APK | `app/build/outputs/apk/androidTest/prod/debug/app-prod-debug-androidTest.apk` |
|
|
| ProGuard mapping | `app/build/outputs/mapping/prodRelease/mapping.txt` |
|
|
| Baseline profile | `app/build/outputs/baselineProfiles/prodRelease/baseline-prof.txt` |
|
|
|
|
## Signing
|
|
|
|
The app uses Google Play App Signing. The upload key is managed via `key.properties`:
|
|
|
|
1. Copy template: `cp key.properties.template key.properties`
|
|
2. Edit with your credentials
|
|
3. Build: `./gradlew bundleProdRelease`
|
|
|
|
The `key.properties` file is in `.gitignore` and should NEVER be committed.
|