title: Execution failed for task ':app:cleanMergeDebugAssets' while running the app in flutter
body: <p>Main error while running the app in Visual Studio Code v1.46.1</p>
  <pre><code>FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:cleanMergeDebugAssets'.
  &gt; Unable to delete directory 'E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out'
      Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
      - E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets\assets
      - E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets\packages\cupertino_icons
      - E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets\packages
      - E:\ACNO\Flutter\jots_mobile\build\app\intermediates\merged_assets\debug\out\flutter_assets
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
  
  * Get more help at https://help.gradle.org
  
  BUILD FAILED in 50s
  Exception: Gradle task assembleDebug failed with exit code 1
  Exited (sigterm)
  </code></pre>
  <p>This error gets resolved after <code>flutter clean</code> but even that shows the following error</p>
  <p>Below is the output of <code>flutter clean</code></p>
  <pre><code>Failed to remove build. A program may still be using a file in the directory or the directory itself. To find and stop such a program, see:
  https://superuser.com/questions/1333118/cant-delete-empty-folder-because-it-is-used
  Deleting build...                                                   19ms
  Failed to remove E:\ACNO\Flutter\jots_mobile\.dart_tool. A program may still be using a file in the directory or the directory itself. To find and stop such a program, see:   
  https://superuser.com/questions/1333118/cant-delete-empty-folder-because-it-is-used
  Deleting .dart_tool...                                              21ms
  Deleting Generated.xcconfig...                                       4ms
  Deleting flutter_export_environment.sh...
  </code></pre>
  <p>Even when I kill the processes which are using <em>build</em> and <em>.dart_tool</em> folders as mentioned in <a href="https://superuser.com/questions/1333118/cant-delete-empty-folder-because-it-is-used">this answer</a>, <code>flutter clean</code> will show the same error</p>
  <p>So, now I've to manually go to file explorer and delete the <em>build</em> &amp; <em>.dart_tool</em> folders, which is the main issue here!</p>
  <p><strong>Summary:</strong> Main error while running the app gets resolved after <code>flutter clean</code> but even that is showing an error, so now I've to manually go and delete <em>build</em> &amp; <em>.dart_tool</em> folders!</p>
  <blockquote>
  <p>Q. How can I resolve these issues?</p>
  </blockquote>
  <p><strong>Update:</strong> Just noticed that this error occurs when I use &quot;f5&quot; to run my program in VS code and not when I use <code>flutter run</code> command in terminal or in Android Studio, but once it has occurred with &quot;f5&quot;, it happens with <code>flutter run</code> command and Android Studio both. There is something wrong with the extension in VS Code that enables this &quot;f5&quot; shortcut, I guess!</p>
  <p>Checkout these GitHub issues • <a href="https://github.com/flutter/flutter/issues/59975" rel="nofollow noreferrer">flutter/flutter</a> • <a href="https://github.com/fwcd/vscode-kotlin/issues/40" rel="nofollow noreferrer">fwcd/vscode-kotlin</a></p>