That my experience as a Windows user.
I had this error, when trying to build with flutter build apk --split-per-abi
:
FAILURE: Build failed with an exception.* What went wrong:Execution failed for task ':app:packageRelease'.> java.io.IOException: Unable to delete directory 'D:\Users\mikyll\flutter_application\build\app\outputs\apk\release' Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory. - D:\Users\mikyll\flutter_application\build\app\outputs\apk\release\app-arm64-v8a-release.apk - D:\Users\mikyll\flutter_application\build\app\outputs\apk\release\app-armeabi-v7a-release.apk - D:\Users\mikyll\flutter_application\build\app\outputs\apk\release\app-x86_64-release.apk* 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.orgBUILD FAILED in 1m 56sRunning Gradle task 'assembleRelease'... 117,7s┌─ Flutter Fix ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│ [!] Your project requires a newer version of the Kotlin Gradle plugin. ││ Find the latest version on https://kotlinlang.org/docs/releases.html#release-details, then update D:\Users\mikyll\flutter_application\android\build.gradle: ││ ext.kotlin_version = '<latest-version>'│└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘Gradle task assembleRelease failed with exit code 1
I updated ext.kotlin_version
to the latest (1.9.22 when I'm writing this answer), but it kept failing.
As the error is suggesting, the problem was the OpenJDK Platform binary process was frozen for some reason and flutter build
could not replace the previous built APKs with the new one, since they were busy (open in that process).
Solution That Worked For Me
I solved by terminating OpenJDK Platform binary process from task manager, deleting the old APK releases, and the next build went straight forward