Unity build to Android failed, because file is in use

Windows PC, building in Unity 2020.1.0f1 to Android

After updating to the latest version of Unity, I am no longer able to build any project to Android, though building to other platforms works perfectly.

I’ve tried reinstalling all of the Android related external tools (JDK, Android SDK and Android NDK), but was unable to delete some files as they were in use by openJDK. I think there is a ghost instance of OpenJDK running in the background blocking access to Gradle files, but I can’t end this instance through task manager, as it doesn’t show up in any sub-processes or background processes.

this is the debug output I’m receiving :

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not create service of type FileAccessTimeJournal using GradleUserHomeScopeServices.createFileAccessTimeJournal().

Timeout waiting to lock journal cache (C:\Users\Mikolaj.gradle\caches\journal-1). It is currently in use by another Gradle instance.
Owner PID: 9680
Our PID: 10600
Owner Operation:
Our operation:
Lock file: C:\Users\Mikolaj.gradle\caches\journal-1\journal-1.lock

  • 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 1m 6s
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8

Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

exit code: 1
UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action1[T] progress, System.String error) (at <59b231ad19bf42f6b72bf2546a9b9393>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action1[T] progress) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
Rethrow as GradleInvokationException: Gradle build failed
UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
Rethrow as BuildFailedException: Exception of type ‘UnityEditor.Build.BuildFailedException’ was thrown.
UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <59b231ad19bf42f6b72bf2546a9b9393>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

problem solved. Where restarting the computer changed nothing, logging off and to a different account, and then back to the main account resolved the isssue on both accounts.