[Solved] Android studio Start Error: internal error

1. Fault

Android studio start error: internal error
java.util.concurrent.CompletionException: java.net.BindException: Address already in use
the IDE cannot be opened due to such an error

2. General solutions

According to the analysis of many people, it is necessary to use Netsh Winsock reset on CMD to reset the network:

netsh winsock reset

If you restart your computer and open Android Studio again, you can open it successfully if you open it immediately, but if you open Android Studio after a while after your computer restarts, you may still report an error and cannot open it. There is also a possibility that if you open it this time, you will not be able to open it again next time.

So this solution does not work.

On the Internet, there are also those who turn off the firewall, and add a line of code disable.android.first.run=true at the end of Android Studio\bin\idea.properties in the installation directory, but they are not reliable.

Uninstall Android Studio and reinstall it.


3. The ultimate solution
Android Studio will start the server on the local host for internal processes and try to bind on any port between 6942 and 6991. And the computer Hyper-V will reserve many ports, once the ports 6942~6991 are in reserved state, Android Studio cannot be opened (report java.util.concurrent.CompletionException: java.net: Address already in use error).

Check the reserved port using the command.

netsh int ipv4 show excludedportrange protocol=tcp

Solution: exclude the port range we need and don’t let Hyper-V keep it

Restart the computer, open CMD with administrator authority, and enter the following instructions:

netsh int ip add excludedportrange protocol=tcp startport=6942 numberofports=50

It’s that simple. If you solve the problem, there will be no problem that Android studio can’t open and report errors in the future.

Such errors may occur when using the above instructions:
This is because, after restarting the computer, the commands are entered too slowly and are taken up by Hyper-V before they have a chance to be executed. Remember to be fast.
Or, go to the BIOS to turn Hyper-V off, then start the computer, slowly enter the above instructions, and when the instructions are finished, go to the BIOS to turn on Hyper-V

Read More: