Skip to content

fix(platform-android): restore port forwarding before app launches - #211

Open
l2hyunwoo wants to merge 1 commit into
callstackincubator:mainfrom
l2hyunwoo:fix/android-reverse-recovery
Open

l2hyunwoo wants to merge 1 commit into
callstackincubator:mainfrom
l2hyunwoo:fix/android-reverse-recovery

Conversation

@l2hyunwoo

Copy link
Copy Markdown

What is this?

Android app launches now restore missing adb reverse mappings before starting the app. If forwarding disappears between test files, Harness can reconnect to Metro instead of exhausting all three launch attempts while Metro remains healthy on the host.

Fixes #210.

How does it work?

The existing forwarding setup is shared by platform initialization and each emulator or physical-device app session. After stopping the previous app process, Harness restores the configured Metro port and the existing 8080 mapping before launching the app. A forwarding error prevents that launch and propagates to the caller.

This applies to both process resets between files and startup retries. Timeout settings and test isolation stay unchanged. It does not address commands interrupted while the ADB server itself is shutting down.

Testing

Four regression tests cover both Android device factories: restoring lost mappings across successive sessions with a custom Metro port, and rejecting a launch when forwarding fails. All four fail on the original implementation and pass with this change; all 19 instance tests pass.

pnpm build:all, pnpm lint:all, pnpm test:all, pnpm typecheck:all, and pnpm exec nx release plan:check --base=upstream/main pass. The repository's docs typecheck target is disabled by its existing configuration.

The issue's emulator recordings and logs show the same two trivial tests on API 35 arm64: removing Metro forwarding after the first passing file causes a startup failure without the patch; with the patch, both files pass. The built Android implementation in this PR matches that validated implementation except for comments. Physical-device behavior is covered by unit tests, not a device run.

Why is this useful?

Local Android test runs recover from lost forwarding on the next app launch without increasing startup timeouts or disabling process resets. A patch version plan is included.

@vercel

vercel Bot commented Oct 18, 2026

Copy link
Copy Markdown

@l2hyunwoo is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android startup retries do not restore lost adb reverse mappings

1 participant