Error installing cold swap patches: java.net.SocketException: Broken pipeError while Installing restart patches
我已经尽力了,但是没有运气。

(Error while Installing restart patches when launching android app with Android Studio 2.0)

有人可以帮我吗?

gradle:3.2.1
Android Studio:2.2.3

日志:

2017-01-06 20:56:00,710 [9781722]   WARN -                    #InstantRun - Failed to push dex files:
java.net.SocketException: Broken pipe
  at java.net.SocketOutputStream.socketWrite0(Native Method)
  at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
  at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
  at java.io.DataOutputStream.write(DataOutputStream.java:107)
  at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
  at com.android.tools.fd.client.ApplicationPatchUtil.write(ApplicationPatchUtil.java:53)
  at com.android.tools.fd.client.ApplicationPatchUtil.write(ApplicationPatchUtil.java:42)
  at com.android.tools.fd.client.InstantRunClient$4.communicate(InstantRunClient.java:399)
  at com.android.tools.fd.client.InstantRunClient$4.communicate(InstantRunClient.java:393)
  at com.android.tools.fd.client.InstantRunClient.talkToAppWithinPortForward(InstantRunClient.java:233)
  at com.android.tools.fd.client.InstantRunClient.talkToApp(InstantRunClient.java:202)
  at com.android.tools.fd.client.InstantRunClient.pushPatches(InstantRunClient.java:393)
  at com.android.tools.fd.client.InstantRunClient.pushPatches(InstantRunClient.java:349)
  at com.android.tools.idea.fd.InstantRunManager.pushArtifacts(InstantRunManager.java:187)
  at com.android.tools.idea.run.tasks.DexDeployTask.perform(DexDeployTask.java:56)
  at com.android.tools.idea.run.LaunchTaskRunner.run(LaunchTaskRunner.java:114)
  at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
  at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:142)
  at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:446)
  at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:392)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
  at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:127)
  at com.intellij.openapi.progress.impl.ProgressManagerImpl$1.run(ProgressManagerImpl.java:126)
  at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:369)
  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:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)

最佳答案


I think the problem is due to instant run feature of Android Studio 2.0.and above This might help

1.Open the Settings or Preferences dialog.
2.Navigate to Build, Execution, Deployment > Instant Run.
Uncheck the box next to Restart activity on code changes

10-07 12:24