Skip to content

Commit 150bd0f

Browse files
feat(android): add run:device task for standalone APK install
- Add android:run:device task that builds release APK, signs with debug keystore, and installs on physical device (mirrors ios:run:device) - Fix android:build:apk/aab to use correct --apk/--aab flag syntax - Remove --open flag from android:dev:device for auto-deployment - Update CLAUDE.md with Taskfile-based Android workflow commands
1 parent a013c33 commit 150bd0f

3 files changed

Lines changed: 39 additions & 16 deletions

File tree

CLAUDE.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,26 @@ task ios:testflight
4848
# Upload to App Store
4949
task ios:release
5050

51-
# Development (Android emulator - requires Android SDK/NDK setup)
52-
npx tauri android dev
51+
# Development (Android emulator)
52+
task android:dev
5353

54-
# Build (Android release APK and AAB)
55-
npx tauri android build
54+
# Development (physical Android device - hot-reload)
55+
task android:dev:device
5656

57-
# Build via Fastlane (Android)
58-
fastlane android build
57+
# Build and install on physical Android device (standalone APK)
58+
task android:run:device
59+
60+
# Build (Android APK for sideloading)
61+
task android:build:apk
62+
63+
# Build (Android AAB for Google Play)
64+
task android:build:aab
5965

6066
# Upload to Google Play Store beta track
61-
fastlane android beta
67+
task android:testflight
6268

6369
# Upload to Google Play Store production
64-
fastlane android release
70+
task android:release
6571

6672
# Clean build artifacts
6773
task clean
@@ -176,10 +182,10 @@ Tables:
176182

177183
**Next Steps**:
178184
- iOS: Download simulator runtime from Xcode → Settings → Platforms
179-
- iOS: Test on simulator: `npx tauri ios dev`
185+
- iOS: Test on simulator: `task ios` or `task ios:dev`
180186
- iOS: Test on device: `task ios:run:device`
181-
- Android: Test on emulator: `npx tauri android dev` (requires emulator running)
182-
- Android: Test manual feature validation on emulator
187+
- Android: Test on emulator: `task android:dev`
188+
- Android: Test on device: `task android:run:device` (builds release APK, signs with debug key, installs)
183189

184190
## Context
185191

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

taskfiles/android.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,31 @@ tasks:
9595
silent: true
9696

9797
dev:device:
98-
desc: "Run on physical Android device"
98+
desc: "Run on physical Android device (dev mode with hot-reload)"
9999
deps: [":npm:install", "init"]
100100
cmds:
101-
- cmd: cd {{.TAURI_DIR}} && npx tauri android dev --open --host
101+
- cmd: cd {{.TAURI_DIR}} && npx tauri android dev --host
102102
ignore_error: true
103103
interactive: true
104104
silent: true
105105

106+
run:device:
107+
desc: "Build release APK, sign with debug key, and install on physical Android device"
108+
deps: [":npm:install", "init"]
109+
vars:
110+
UNSIGNED_APK: "{{.TAURI_DIR}}/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk"
111+
SIGNED_APK: "{{.TAURI_DIR}}/gen/android/app/build/outputs/apk/universal/release/app-universal-release-signed.apk"
112+
DEBUG_KEYSTORE: "{{.HOME}}/.android/debug.keystore"
113+
APKSIGNER: "{{.ANDROID_HOME}}/build-tools/35.0.0/apksigner"
114+
cmds:
115+
- cd {{.TAURI_DIR}} && npx tauri android build --apk true --aab false
116+
- |
117+
rm -f "{{.SIGNED_APK}}"
118+
"{{.APKSIGNER}}" sign --ks "{{.DEBUG_KEYSTORE}}" --ks-pass pass:android --out "{{.SIGNED_APK}}" "{{.UNSIGNED_APK}}"
119+
adb install -r "{{.SIGNED_APK}}"
120+
adb shell am start -n com.lunch.desktop/.MainActivity
121+
silent: true
122+
106123
build:
107124
desc: "Build for Android distribution (APK and AAB)"
108125
deps: [":npm:install", "init"]
@@ -114,14 +131,14 @@ tasks:
114131
desc: "Build APK only (for testing/sideloading)"
115132
deps: [":npm:install", "init"]
116133
cmds:
117-
- cd {{.TAURI_DIR}} && npx tauri android build --apk
134+
- cd {{.TAURI_DIR}} && npx tauri android build --apk true --aab false
118135
silent: true
119136

120137
build:aab:
121138
desc: "Build AAB only (for Google Play)"
122139
deps: [":npm:install", "init"]
123140
cmds:
124-
- cd {{.TAURI_DIR}} && npx tauri android build --aab
141+
- cd {{.TAURI_DIR}} && npx tauri android build --apk false --aab true
125142
silent: true
126143

127144
testflight:

0 commit comments

Comments
 (0)