错误:任务':app:transformClassesWithInstantRunSlicerForDebug'的执行失败.> java.io.IOException:

Ash*_*ary 44 android

每当我尝试运行我的应用程序时,我都会收到此错误:

错误:任务执行失败

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

 C:\Users\ashis\AndroidStudioProjects\FirstApp\app\build\intermediates\instant-run-support\debug\restart-changes.txt**
Run Code Online (Sandbox Code Playgroud)

这是输出:

信息:Gradle任务

[: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最新消息: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-至今:app:compileDebugJavaWithJavac 最新版本: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错误:任务执行失败':app:transformClassesWithInstantRunSlicerForD ebug".java.io.IOException:无法删除C:\ Users\ashis\AndroidStudioProjects\FirstApp\app\build\intermediates\instant-run-support\debug\restart-changes.txt信息:BUILD FAILED信息:总时间:1分钟6.761秒信息:1错误信息:0警告信息:在控制台中查看完整输出

小智 78

:应用程序:transformClassesWithInstantRunSlicerForDebug".java.io.IOException:无法删除

- 尝试清理项目并重建项目.

来自@Kael:通过Build - > Clean Project或Build - > Rebuild Project执行清理.

  • (对于那些想知道的人,那就是'Build Menu> Clean Project`和`Build Menu> Rebuild Project`) (5认同)
  • 它不工作,当我点击清洁项目它显示相同的错误"错误:执行失败的任务':app:mergeDebugResources'.> java.io.IOException:无法删除路径'xxxxxxxxxx\app\build\intermediates\res \合并\调试\绘制-HDPI-V4' ". (4认同)
  • 这种情况经常发生.还有其他任何方法可以防止它发生吗? (4认同)

Dex*_*ter 31

请按照以下步骤操作:转到

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

因此,这对我有所帮助。


Mar*_*fer 8

在我的情况下Build Menu > Clean Project and Build Menu > Rebuild没有工作.相反,我不得不build从文件系统中手动删除文件夹(在OSX上使用Finder,在Win上使用Explorer).