44

whenever I try to run my app i get this error :

Error:Execution failed for task

 :app:transformClassesWithInstantRunSlicerForDebug'. java.io.IOException: Failed to delete C:\Users\ashis\AndroidStudioProjects\FirstApp\app\build\intermediates\instant-run-support\debug\restart-changes.txt** 

and here is the output:

Information:Gradle tasks

[:app:assembleDebug] :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:mergeDebugShaders UP-TO-DATE :app:compileDebugShaders UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources UP-TO-DATE :app:generateDebugSources UP-TO-DATE :app:incrementalDebugJavaCompilationSafeguard UP-TO-DATE :app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:compileDebugSources UP-TO-DATE :app:buildInfoDebugLoader :app:transformClassesWithExtractJarsForDebug UP-TO-DATE :app:transformClassesWithInstantRunVerifierForDebug UP-TO-DATE :app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE :app:mergeDebugJniLibFolders UP-TO-DATE :app:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE :app:processDebugJavaRes UP-TO-DATE :app:transformResourcesWithMergeJavaResForDebug UP-TO-DATE :app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug UP-TO-DATE :app:transformClassesWithInstantRunForDebug UP-TO-DATE :app:transformClasses_enhancedWithInstant+reloadDexForDebug UP-TO-DATE :app:incrementalDebugTasks :app:prePackageMarkerForDebug :app:fastDeployDebugExtractor UP-TO-DATE :app:generateDebugInstantRunAppInfo UP-TO-DATE :app:coldswapKickerDebug :app:transformClassesWithInstantRunSlicerForDebug FAILED Error:Execution failed for task ':app:transformClassesWithInstantRunSlicerForDebug'. java.io.IOException: Failed to delete C:\Users\ashis\AndroidStudioProjects\FirstApp\app\build\intermediates\instant-run-support\debug\restart-changes.txt Information:BUILD FAILED Information:Total time: 1 mins 6.761 secs Information:1 error Information:0 warnings Information:See complete output in console

7 Answers 7

77

:app:transformClassesWithInstantRunSlicerForDebug'. java.io.IOException: Failed to delete

-- try to clean project and rebuild project.

From @Kael: A clean is performed via Build -> Clean Project or Build -> Rebuild Project.

Sign up to request clarification or add additional context in comments.

6 Comments

(For those who are wondering, that's Build Menu > Clean Project and Build Menu > Rebuild Project)
its not working, when i click clean project it shows the same error"Error:Execution failed for task ':app:mergeDebugResources'. > java.io.IOException: Could not delete path 'xxxxxxxxxx\app\build\intermediates\res\merged\debug\drawable-hdpi-v4'."
@Prasad: Same here.
I know it's not the place for it... but THANKS A LOT.
This happens far too often. Any other way to prevent it from happening?
|
32

Kindly follow these steps: Goto

1>File 2>Settings 3>Build,Execution,Deployment 4>Instant Run 5>Uncheck (Enable Instant Run to hot swap code) 

So this helped me.

Comments

8

In my situation Build Menu > Clean Project and Build Menu > Rebuild did NOT work. Instead I had to delete the build folder manually from the filesystem (using Finder on OSX, Explorer on Win).

Comments

1

Try to clean project and rebuild project from Build Menu > Clean Project and Build Menu > Rebuild try restarting android studio or use android studio on different user

Comments

1

I had the same problem .. I solved my problem by deleting .gradle file on my project root and rebuilt my project again.

Comments

1

I had Execution failed for task ':app:generateDebugBuildConfig'. error, cleaning and rebuilding project was not working.

  1. I added C:\Users\...\AppData\Local\Android\sdk\tools to my PATH Environment variable.
  2. I closed android studio and vscode that I was using for edit project files. (This is very important)
  3. I run the project and it worked fine.

Comments

0

Change this https://services.gradle.org/distributions/gradle-4.4-all.zip to this https://services.gradle.org/distributions/gradle-4.1-all.zip in grable-wrapper.prperties. And then re import the properties. and sync the project.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.