Reputation: 988
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?
Upvotes: 34
Views: 20555
Reputation: 1
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.
Upvotes: 0
Reputation: 1
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:
For me this solution works.
Upvotes: 0
Reputation: 23
This is session related issue. Restart studio and avoid pulling cable during instant run for future repeat of this problem.
Upvotes: 0
Reputation: 1998
I updated Android Studio to 2.2.3 and Gradle to 2.14.1 and it worked.
Upvotes: 0
Reputation: 742
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.
Upvotes: 0
Reputation: 1110
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.
Upvotes: 0
Reputation: 31
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.
Upvotes: 0
Reputation: 21
Me to having the same issue and u can resolve it by uninstalling the app before running the app from android studio
Upvotes: 1
Reputation: 3608
I think the issue is due to instant run feature of Android Studio 2.0. This might help
Upvotes: 14
Reputation: 1298
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.
Upvotes: 1