How run android (USB) in API localhost (net::ERR_CONNECTION_REFUSED)

I have a APIs in Laravel in localhost and with ionic runing android device with USB
but a get this error net::ERR_CONNECTION_REFUSED

How can I access my Api in my localhost with ionic run android -l ?

localhost (and are the host that the HTTP request is being made from. So if you’re running on an android device, that means it’s expecting the HTTP server to be on that device.

I would recommend always using proper DNS hostnames for everything. It makes all these problems go away.

do you have someone link about it ?

Link about what? How to set up a DNS server? What I do is install OpenWRT on a router and use dnsmasq on it. To pick a domain guaranteed not to conflict with anything out there on the Internet, follow RFC 2606. I use something ending in “.invalid”.