android即时运行总是失败

时间:2017-01-06 10:37:31

标签: android gradle

Error installing cold swap patches: java.net.SocketException: Broken pipe Error 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)

1 个答案:

答案 0 :(得分:1)

  

请执行以下步骤

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