打开Android Studio报错,Unable to create Channel from class class

问题

打开Android Studio报错,报错信息如下:

Internal Error. Please report to https://code.google.com/p/android/issues

io.netty.channel.ChannelException: Unable to create Channel from class class io.netty.channel.socket.oio.OioServerSocketChannel
    at io.netty.channel.ReflectiveChannelFactory.newChannel(ReflectiveChannelFactory.java:40)
    at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:321)
    at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:283)
    at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:279)
    at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:268)
    at org.jetbrains.io.BuiltInServer.bind(BuiltInServer.java:151)
    at org.jetbrains.io.BuiltInServer.start(BuiltInServer.java:120)
    at org.jetbrains.io.BuiltInServer.startNioOrOio(BuiltInServer.java:105)
    at com.intellij.idea.SocketLock.lambda$lock$2(SocketLock.java:153)
    at com.intellij.idea.SocketLock.underLocks(SocketLock.java:181)
    at com.intellij.idea.SocketLock.lock(SocketLock.java:128)
    at com.intellij.idea.StartupUtil.lockSystemFolders(StartupUtil.java:295)
    at com.intellij.idea.StartupUtil.prepareAndStart(StartupUtil.java:122)
    at com.intellij.idea.MainImpl.start(MainImpl.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.ide.plugins.PluginManager.lambda$start$0(PluginManager.java:92)
    at java.lang.Thread.run(Thread.java:745)
Caused by: io.netty.channel.ChannelException: Failed to set the server socket timeout.
    at io.netty.channel.socket.oio.OioServerSocketChannel.<init>(OioServerSocketChannel.java:85)
    at io.netty.channel.socket.oio.OioServerSocketChannel.<init>(OioServerSocketChannel.java:66)
    at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at io.netty.channel.ReflectiveChannelFactory.newChannel(ReflectiveChannelFactory.java:38)
    ... 19 more
Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
    at java.net.ServerSocket.createImpl(ServerSocket.java:307)
    at java.net.ServerSocket.getImpl(ServerSocket.java:257)
    at java.net.ServerSocket.setSoTimeout(ServerSocket.java:652)
    at io.netty.channel.socket.oio.OioServerSocketChannel.<init>(OioServerSocketChannel.java:82)
    ... 25 more

分析

根据两个Caused by,原因应该是由于未被承认的Windows Sockets导致Android Studio初始化的时候设置服务连接超时。

Caused by: io.netty.channel.ChannelException: Failed to set the server socket timeout.
Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 10106: create

解决方法

1、使用管理员身份打开命令提示符工具
打开Android Studio报错,Unable to create Channel from class class_第1张图片
2、输入命令
netsh winsock reset
打开Android Studio报错,Unable to create Channel from class class_第2张图片
netsh winsock reset命令,作用是重置 Winsock 目录。如果一台机器上的Winsock协议配置有问题的话将会导致网络连接等问题,就需要用netsh winsock reset命令来重置Winsock目录借以恢复网络。这个命令可以重新初始化网络环境,以解决由于软件冲突、病毒原因造成的参数错误问题。 netsh是一个能够通过命令行操作几乎所有网络相关设置的接口,比如设置IPDNS,网卡,无线网络等,Winsock是系统内部目录,WinsockWindows网络编程接口,winsock工作在应用层,它提供与底层传输协议无关的高层数据传输编程接口,reset是对Winsock的重置操作。当执行完winsock的命令重启计算机后,需要重新配置IP
3、重启电脑,再打开Android Studio

你可能感兴趣的:(Android,Studio)