Skip to content

fix(android): stop rewriting localhost to 10.0.2.2#1380

Open
MikitasK wants to merge 3 commits intocallstack:mainfrom
MikitasK:fix/hmr-on-android-physical-device
Open

fix(android): stop rewriting localhost to 10.0.2.2#1380
MikitasK wants to merge 3 commits intocallstack:mainfrom
MikitasK:fix/hmr-on-android-physical-device

Conversation

@MikitasK
Copy link
Copy Markdown

@MikitasK MikitasK commented Apr 16, 2026

Summary

Issue #1247

Fix Android physical-device dev server resolution by removing the unconditional runtime rewrite from localhost to 10.0.2.2

Previously, re.pack treated every Android runtime like an emulator. That caused:

  • HMR websocket URLs to resolve to ws://10.0.2.2:8081/__hmr
  • async chunk URLs to resolve to http://10.0.2.2:8081/...

It works on emulators, but breaks on physical devices, where 10.0.2.2 is unreachable

This change makes re.pack use the configured dev-server host literally, which allows Android physical devices to work correctly with the standard localhost + adb reverse flow

Test Plan

  1. connect an Android physical device with USB debugging enabled
  2. start the dev server from apps/tester-app with the default host by pnpm react-native webpack-start
  3. run adb reverse tcp:8081 tcp:8081
  4. launch "Tester App" on the Android physical device
  5. confirm the app loads successfully
  6. edit visible UI file such as apps/tester-app/src/App.tsx & save
  7. confirm HMR works - the UI should updates without full app relaunch

Recordiing

Screen.Recording.2026-04-16.at.19.01.41.mp4

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 16, 2026

🦋 Changeset detected

Latest commit: a72b21f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@callstack/repack Patch
@callstack/repack-plugin-expo-modules Patch
@callstack/repack-plugin-nativewind Patch
@callstack/repack-plugin-reanimated Patch
@callstack/repack-dev-server Patch
@callstack/repack-init Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 16, 2026

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

A member of the Team first needs to authorize it.

@MikitasK MikitasK changed the title fix: stop rewriting android localhost to 10.0.2.2 fix(android): stop rewriting localhost to 10.0.2.2 Apr 16, 2026
@dannyhw
Copy link
Copy Markdown
Collaborator

dannyhw commented Apr 21, 2026

What a find! Nice job!

@dannyhw
Copy link
Copy Markdown
Collaborator

dannyhw commented Apr 21, 2026

@MikitasK can you please add a changeset 🙏

Comment thread .changeset/twenty-bushes-act.md
@dannyhw
Copy link
Copy Markdown
Collaborator

dannyhw commented Apr 22, 2026

@MikitasK could you double check on emulator that it doesn't break. Like if you fully create a fresh build etc just to make sure

@MikitasK
Copy link
Copy Markdown
Author

@MikitasK could you double check on emulator that it doesn't break. Like if you fully create a fresh build etc just to make sure

sure thing @dannyhw 👌 double-checking these changes before merge makes a lot of sense
here is the recording of how it look like on my side from clean repo state on wiped emulator:

Screen.Recording.2026-04-22.at.20.06.21.mp4

the behavior is pretty much the same - it works as expected ☑️

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.

2 participants