DEV Community

Cover image for Connecting Android Apps to localhost, Simplified

Connecting Android Apps to localhost, Simplified

Tushar Sadhwani on April 17, 2021

P.S. if you're in a hurry, find the correct solution here I was working on a full stack side project a few months ago, and I wanted to make API ...
Collapse
 
abdnezar profile image
Abd Nezar •

amazing

Collapse
 
janezk7 profile image
janezk7 •

Wow, great stuff! Trying looking for a similar solution for a while and ended up a public forwarding service like ngrok for a while, but that comes with its own limitations.

Collapse
 
mohamed_wahid_4b35b1689ad profile image
Mohamed Wahid •

Thank you

Collapse
 
msfjarvis profile image
Harsh Shandilya •

Learned something new! Great post :)

Collapse
 
tusharsadhwani profile image
Tushar Sadhwani •

you're welcome (;

Collapse
 
andrewreeman profile image
Andrew Reeman •

Great tip! Thanks

Collapse
 
tusharsadhwani profile image
Tushar Sadhwani •

:D

Collapse
 
wireless90 profile image
wireless90 •

Nice i only knew about adb forward, but it makes a lot of sense to also have adb reverse.

Collapse
 
tusharsadhwani profile image
Tushar Sadhwani • • Edited

Ikr, i got to know about adb reverse because I read about adb forward on some obscure stackoverflow answer, and I wondered if a reverse port forwarding also exists, so I blindly tried adb reverse. And it worked.

Collapse
 
hassansiddiqi profile image
Hassan Farooq Siddiqi •

Thanks a lot!

Collapse
 
uuc110 profile image
Sourabh •

Do you know anything like? connecting smartTV/androind using ADB, like so i can forward my local host web server to TV to see my live changes

Collapse
 
dhiraj_sable_8fbd808129dc profile image
Dhiraj Sable •

Instead of this may try to use DHCP IP reservation featuron on your home Wi-Fi router so that IP will be same every time device connects toWI-Fi. I am using this feature for my RaspberryPi.

Collapse
 
drifting_horizon profile image
Drifting Horizon •

Finally... Thanks a bunch! XD

Collapse
 
drifting_horizon profile image
Drifting Horizon •

Still, this is simply a workaround for my case cuz I can't access localhost:port from my Android phone. I'm still searching for a way to fix the issue.