question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide an option to auto forward tcp port for Android emulators

See original GitHub issue

I usually use HotReload simultaneously on Android emulator and iOS simulator, the new auto discover feature is great and allows for a scenario where I can just set a random port to avoid collision when opening multiple emulators/apps.

Unfortunately, for Android emulators, I need to know the port so I can forward it through adb, as mentioned in the README.

My proposal: pass a -auto-forward flag so the Observer can automatically call adb to forward the port. I did this for my project and it is working, so if you think it makes sense, I can just open a new PR. The code looks something like this:

Inside the UdpReceived:

if (!_addresses.Contains(address))
{
    _addresses.Add(address);

    var port = address.Split(':')?[2];
    Process.Start("adb", $"forward tcp:{port} tcp:{port}");
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
akamudcommented, Jun 13, 2019

I’ll open a PR with this improvement.

1reaction
AndreiMisiukevichcommented, Jun 13, 2019

i think this update makes sense 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I forward my localhost IP-Address to an Android ...
To forward a port from your local machine to an Android Emulator, you need to have Telnet enabled. This is done through the...
Read more >
Set up Android Emulator networking | Android Studio
To set up the network redirection, create a mapping of host and guest ports and addresses on the emulator instance. There are two...
Read more >
Setup TCP and UDP forwarding to Android Emulator
Forwarding TCP traffic to android emulator is simple. Just use the adb tool like this to forward host port 2222 to port 3333...
Read more >
Android emulator access to local server
In this solution, we'll instruct the emulator to redirect the IP address from the host machine to the loopback IP address automatically. We'll ......
Read more >
Android Emulator | Android Developers
The Android emulator is a QEMU-based application that provides a virtual ARM mobile device on which you can run your Android applications.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found