2017-01-03 186 views
2

將Android Studio升級到2.3後,我最近在構建項目時不斷看到此錯誤。無法啓動進程'命令'/應用程序/ Android Studio.app/.../bin/java''

失敗:生成失敗並出現異常。

  • 出了什麼問題: 執行失敗的任務 ':應用程序:compileRetrolambdaLocalDebug'。

    的問題發生起動過程中 '命令「/應用/ Android的Studio.app/Contents/jre/jdk/Contents/Home/bin/java'

  • 嘗試: 運行帶 - -stacktrace選項來獲取堆棧跟蹤。使用--info或--debug選項運行以獲取更多日誌輸出。

清洗和重建解決了問題。但不得不一次又一次地做這件事。任何更好的解決方法?

編輯:


編譯在終端與$ ./gradlew --stacktrace --info assembleDebug

* What went wrong: 
Execution failed for task ':app:compileRetrolambdaLocalDebug'. 
> A problem occurred starting process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java'' 

* Try: 
Run with --debug option to get more log output. 

* Exception is: 
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileRetrolambdaLocalDebug'. 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) 
     at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) 
     at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) 

     ... 
     ... 
     ... 

     at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:237) 
     at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) 
     at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) 
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java'' 
     at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:197) 
     at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:327) 
     at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86) 
     ... 2 more 
Caused by: net.rubygrapefruit.platform.NativeException: Could not start '/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java' 
     at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27) 
     at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36) 
     at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68) 
     ... 2 more 
Caused by: java.io.IOException: Cannot run program "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java" (in directory "/Users/yuchen/Documents/MountainView2/app"): error=7, Argument list too long 
     at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) 
     ... 4 more 
Caused by: java.io.IOException: error=7, Argument list too long 
     ... 5 more 



BUILD FAILED 

在終端編譯與$ ./gradlew --stacktrace --debug assembleDebug

15:31:43.654 [ERROR] [org.gradle.BuildExceptionReporter]  ... 2 more 
15:31:43.654 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: Cannot run program "/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home/bin/java" (in directory "/Users/yuchen/Documents/MountainView2/app"): error=7, Argument list too long 
15:31:43.654 [ERROR] [org.gradle.BuildExceptionReporter]  at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) 
15:31:43.655 [ERROR] [org.gradle.BuildExceptionReporter]  ... 4 more 
15:31:43.655 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.io.IOException: error=7, Argument list too long 
15:31:43.656 [ERROR] [org.gradle.BuildExceptionReporter]  ... 5 more 
15:31:43.656 [ERROR] [org.gradle.BuildExceptionReporter] 
15:31:43.656 [LIFECYCLE] [org.gradle.BuildResultLogger] 
15:31:43.656 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED 
+0

嘗試從命令行構建幷包含推薦的開關('--stacktrace'和'--info'或'--debug'),並查看是否獲得有關正在進行的更多詳細信息錯誤。 – CommonsWare

+0

@CommonsWare,它花了我一段時間來重現它。這裏是堆棧跟蹤(編輯答案)。它只發生一次,這是非常煩人的。任何線索? –

+0

「參數列表太長」很有趣。我認爲日誌實際上並沒有顯示完整的命令和參數? – CommonsWare

回答

2

我們發現這種情況的發生是由於retrolamdba插件中,錯誤在retrolambda argum的值中經濟需求。

升級插件修復了問題。請參閱版本說明3.2.5