2017-03-17 87 views
0

好的,Android的新功能。全新安裝,Windows 10,具有空活動的基本模板項目。當我開始項目啓動同步的gradle在我家的gradle與以下錯誤Android Studio項目的Gradle守護程序無法啓動

org.gradle.api.UncheckedIOException: java.io.IOException: Unable to establish loopback connection 
    at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:43) 
    at org.gradle.internal.remote.internal.inet.SocketConnection.<init>(SocketConnection.java:60) 
    at org.gradle.internal.remote.internal.inet.SocketConnectCompletion.create(SocketConnectCompletion.java:39) 
    at org.gradle.launcher.daemon.server.DaemonTcpServerConnector$1.execute(DaemonTcpServerConnector.java:73) 
    at org.gradle.launcher.daemon.server.DaemonTcpServerConnector$1.execute(DaemonTcpServerConnector.java:69) 
    at org.gradle.internal.remote.internal.inet.TcpIncomingConnector$Receiver.run(TcpIncomingConnector.java:112) 
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) 
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: java.io.IOException: Unable to establish loopback connection 
    at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:101) 
    at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:68) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at sun.nio.ch.PipeImpl.<init>(PipeImpl.java:170) 
    at sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50) 
    at java.nio.channels.Pipe.open(Pipe.java:155) 
    at sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:127) 
    at sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44) 
    at java.nio.channels.Selector.open(Selector.java:227) 
    at org.gradle.internal.remote.internal.inet.SocketConnection$SocketInputStream.<init>(SocketConnection.java:142) 
    at org.gradle.internal.remote.internal.inet.SocketConnection.<init>(SocketConnection.java:58) 
    ... 9 more 
Caused by: java.net.SocketException: Permission denied: connect 
    at sun.nio.ch.Net.connect0(Native Method) 
    at sun.nio.ch.Net.connect(Net.java:454) 
    at sun.nio.ch.Net.connect(Net.java:446) 
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648) 
    at java.nio.channels.SocketChannel.open(SocketChannel.java:189) 
    at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:130) 
    at sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:83) 
    ... 19 more 

我得到同樣的錯誤,當我運行對gradlew.bat文件的基本命令的gradle開始生成日誌,但是當我首先運行set _JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true,然後成功啓動守護進程。問題是,我如何使用這些信息使項目工作中的gradle同步。我已經嘗試在gradle.properties文件中添加-Djava.net.preferIPv4Stack = true,嘗試將set _JAVA_OPTIONS=-Djava.net.preferIPv4Stack=true添加到項目gradle批處理文件中,現在我沒有選擇了。

+0

重新啓動計算機可能會有幫助! – Shubham

+0

已經做了幾個星期 – user3221872

回答

0

好的,終於搞明白了。我去了環境變量,並設置了一個_JAVA_OPTS用戶變量作爲值-Djava.net.preferIPv4Stack = true。

相關問題