Error running ‘Android Debugger (-1)‘ [How to Solve]

The Android studio attach debugger suddenly fails. Read the event log and report an error

2: 10 PM can’t bind to local – 1 for debugger

2: 10 PM error running ‘Android debugger (- 1)’: unknown error

2: 10 PM error running ‘Android debugger (- 1)’
invalid argument: argument invalid
[port]

There are similar port occupancy and other errors on the Internet, but those are basically a specific port, which is directly – 1 port. At first, I wanted to change the debugger’s port in preference to use existing manually managed server, and specify a port, so I couldn’t connect directly.

After that, I thought it was because preview and the official version were installed at the same time, and then I reinstalled Android studio.

Finally, it was solved. It turned out that the host file needs to map localhost to 127.0.0.1

127.0.0.1       localhost 

Read More: