0

尝试打开 Android Studio 终端时出现以下错误。


Cannot open Local Terminal
Failed to start [cmd.exe] in D:/NirapodBima

See your idea.log (Help | Show Log in Explorer) for the details.

根据错误日志指令进入idea.log文件并发现以下错误。错误日志显示 winpty 可执行文件丢失,但我不知道如何解决此错误。也尝试将 Android Studio 作为管理模式,但没有运气。

2020-06-15 07:48:44,841 [2404236]   INFO - m.pty4j.windows.WindowsVersion - Windows version: 6.3.9600 
2020-06-15 07:48:44,845 [2404240]   INFO - erminal.AbstractTerminalRunner - Cannot open Local Terminal 
java.util.concurrent.ExecutionException: Failed to start [cmd.exe] in D:/NirapodBima
    at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:225)
    at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:48)
    at org.jetbrains.plugins.terminal.AbstractTerminalRunner.lambda$openSessionInDirectory$4(AbstractTerminalRunner.java:208)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Couldn't create PTY
    at com.pty4j.windows.WinPtyProcess.<init>(WinPtyProcess.java:75)
    at com.pty4j.windows.WinPtyProcess.<init>(WinPtyProcess.java:50)
    at com.pty4j.PtyProcessBuilder.start(PtyProcessBuilder.java:109)
    at com.pty4j.PtyProcess.exec(PtyProcess.java:78)
    at com.pty4j.PtyProcess.exec(PtyProcess.java:49)
    at org.jetbrains.plugins.terminal.LocalTerminalDirectRunner.createProcess(LocalTerminalDirectRunner.java:217)
    ... 8 more
Caused by: com.pty4j.PtyException: Error starting winpty: agent executable does not exist: 'F:\D-drive\1\lib\pty4j-native\win\x86_64\winpty-agent.exe'
    at com.pty4j.windows.WinPty.<init>(WinPty.java:93)
    at com.pty4j.windows.WinPtyProcess.<init>(WinPtyProcess.java:72)
    ... 13 more
4

1 回答 1

0

我遇到了同样的问题。我相信它与防止“winpty-agent.exe”运行的防病毒或实时扫描程序有关。如果您将此可执行文件和相关的“winpty.dll”文件列入白名单,则可以解决此问题。以下是“winpty-agent.exe”的路径:

C:\Program Files\Android\Android Studio\lib\pty4j-native\win\x86_64

从以下链接了解更多信息:

  1. https://youtrack.jetbrains.com/issue/IDEA-220774
  2. https://forums.malwarebytes.com/topic/255580-ransomware-protection-breaks-terminal-in-android-studio-intellij/
于 2020-07-16T07:48:06.823 回答