34

Currently I'm using Android Studio 2.0 and installing my APK into my Samsung device (S6). However, when rebuilding my code and running it again I receive the following error:

Error installing cold swap patches: com.android.tools.fd.client.InstantRunPushFailedException: Error creating folder with: run-as com.appcustomer mkdir -p /data/data/com.appcustomer/files/instant-run/inbox
Error while Installing restart patches

Does anyone have any idea what this issue is?

10 Answers10

14

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

  1. Open the Settings or Preferences dialog.
  2. Navigate to Build, Execution, Deployment > Instant Run.
  3. Uncheck the box next to Restart activity on code changes
prashant
  • 3,480
  • 7
  • 38
  • 49
1

I am having the same issue. My "fix" was to uninstall the app each time before installing it through Android Studio.
What I think is that if your app is running already, Android Studio is unable to rewrite the "updated" build on top of that. So, either you manually stop the app or add this to Gradle to fix the issue.
I know it's just a workaround and I'd love to get a legitimate fix for this.

Community
  • 1
  • 1
Kanishka Ganguly
  • 1,162
  • 1
  • 15
  • 36
  • The whole point of instant run is to "rewrite the updated build on top". If you don't want instant run (because it sometimes fails), just disable it as proposed by @prashant. – winne2 Jun 10 '16 at 14:35
1

Me to having the same issue and u can resolve it by uninstalling the app before running the app from android studio

0

This started happening on my Samsung Tab A as soon as I installed the Marshmallow upgrade. This was painful because Android Studio had to perform a slow recompile of the entire app for every minor code change. Worse, Instrumentation no longer worked, e.g. an NPE would crash the app without showing any messages in the debug window.

The problems went away when when I reverted back to Lollipop.

Despite what Samsung support told me, I am able to block the annoying Marshmallow upgrade popups by disabling Software update (com.wssyncmldm and com.sec.android.fotaclient).

According to Google "this is a bug on the android software installed on these phones" https://code.google.com/p/android/issues/detail?id=200881. The next device I purchase for app development will not be a Samsung.

Hermann Döppes
  • 1,323
  • 1
  • 18
  • 25
regas
  • 31
  • 1
0

Restarting Android Studio worked for me.

I think the error happens when you disconnect the device when it is running your app from Android Studio.

daisura99
  • 810
  • 1
  • 10
  • 16
0

Clean the project and in File option of Android Studio press Invalidate Caches/ Restart. Disable Instant Run and do a gradle sync. This worked for me. I am using Mac, I think this will be similar in Windows and Ubuntu.

nucleons
  • 742
  • 4
  • 21
0

I updated Android Studio to 2.2.3 and Gradle to 2.14.1 and it worked.

Ispas Claudiu
  • 1,684
  • 2
  • 26
  • 52
0

This is session related issue. Restart studio and avoid pulling cable during instant run for future repeat of this problem.

sadi09
  • 23
  • 1
  • 5
0

I found this solution that works for me (AndroidStudio 2.1.3, Android 6.0.1). With the Android app running, without closing it on the connected device (smartphone/tablet), do the following steps:

  1. Re-launch the Android app on AndroidStudio, with "Run" button (through the green right arrow);
  2. After 1 sec, press on "Stop" button (through the red square);
  3. AndroidStudio shows two different running processes: the already running Android app on on the connected device, and the Gradle compiling process;
  4. Stop the first one (the already running Android app on the connected device), and leave the Gradle process to complete the deployment of the new version of the Android app on the connected device.

For me this solution works.

Luca
  • 1
  • 1
0

Another solution can be by selecting the Run button, the app on the device crashes, since it tries to reopen with an instance of itself already running, and then by selecting another time the Run button.

In this way the patches that need to be applied to the app will be compiled and the app restart with its new version.

Luca
  • 1
  • 2