Bunthong K
Bunthong K

Reputation: 134

Execution failed for task ':app:mergeDebugJavaResource'. - Gradle Task assemble

so I was trying to run my flutter project and then I got this error :

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugJavaResource'.
> java.nio.file.FileSystemException: C:\Users\ASUS\Desktop\Programmin\Flutter\app_with_firebase\build\app\intermediates\merged_java_res\debug\out.jar: The process cannot access the file because it is being used by another process.


* 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 3s
Exception: Gradle task assembleDebug failed with exit code 1

I tried to do : File > Invalidate Chaches/Restart in Android studio, but it won't solve the problem. I also tried to do flutter clean, then flutter run, but It still shows me the same error.

I have no idea what to do now, any help is appreciated.

Thank you !

Upvotes: 0

Views: 2394

Answers (1)

Nick Fisher
Nick Fisher

Reputation: 755

I did a bit more digging with SysInternals and jps and it turns out that the Kotlin Language Server wasn't releasing the lock on the build folder. For me, uninstalling the VS Code fwcd Kotlin extension (and replacing with a different Kotlin language extension, if required) was enough to fix the issue.

On Android Studio, all I can suggest is disabling/uninstalling the Kotlin plugin and seeing if that fixes it for you.

Upvotes: 1

Related Questions