Skip to content

Commit f7a0161

Browse files
abueideclaude
andcommitted
fix(android): remove silent monkey fallback in app launch, fail with clear errors
Replace the monkey command fallback with a clear error when am start fails. Make process verification return non-zero on failure instead of printing a warning. Users get actionable error messages with logcat debugging hints. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f02d746 commit f7a0161

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

  • plugins/android/virtenv/scripts/domain

plugins/android/virtenv/scripts/domain/deploy.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ android_install_apk() {
258258
echo "✓ APK installed"
259259
}
260260

261-
# Launch app on emulator (tries activity manager, falls back to monkey)
261+
# Launch app on emulator via activity manager
262262
android_launch_app() {
263263
package_name="$1"
264264
activity_name="$2"
@@ -271,16 +271,15 @@ android_launch_app() {
271271

272272
android_debug_log "Launch component: $component_name"
273273

274-
# Try launching via activity manager
275-
if adb -s "$emulator_serial" shell am start -n "$component_name" >/dev/null 2>&1; then
276-
echo "✓ App launched via activity manager"
277-
else
278-
echo "WARNING: Activity manager launch failed, trying monkey launcher" >&2
279-
280-
# Fallback: Use monkey to launch via launcher intent
281-
adb -s "$emulator_serial" shell monkey -p "$package_name" -c android.intent.category.LAUNCHER 1 >/dev/null 2>&1 || true
274+
# Launch via activity manager
275+
if ! adb -s "$emulator_serial" shell am start -n "$component_name" >/dev/null 2>&1; then
276+
android_log_error "deploy.sh" "Failed to launch app: $component_name"
277+
android_log_error "deploy.sh" "Verify the package name and activity are correct."
278+
return 1
282279
fi
283280

281+
echo "✓ App launched via activity manager"
282+
284283
# Wait a moment for the app process to start
285284
sleep 2
286285

@@ -298,8 +297,9 @@ android_launch_app() {
298297
fi
299298
done
300299

301-
echo "WARNING: App process not detected after ${max_attempts} attempts" >&2
302-
echo " App may still have launched successfully" >&2
300+
android_log_error "deploy.sh" "App process not detected after ${max_attempts} attempts"
301+
android_log_error "deploy.sh" "Check logcat for crash details: adb -s $emulator_serial logcat -d | grep $package_name"
302+
return 1
303303
}
304304

305305
# Run Android app (build, install, launch)

0 commit comments

Comments
 (0)