forcefully terminating “java.exe” process before every build of Android app lazarus / 43-Android ---------------------------------------------------------------------- neuro · 2025-10-21 04:37 I am building Android app using menu “[LAMW] Build Android Apk and Run”. The source code of Android app is big and complicated. Very often building fails with the following error message: QuoteFatal: FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':packageRelease'. > Multiple task action failures occurred:  > A failure occurred while executing com.android.build.gradle.tasks.P ackageAndroidArtifact$IncrementalSplitterRunnable  > A failure occurred while executing com.android.build.gradle.tasks.P ackageAndroidArtifact$IncrementalSplitterRunnable * Try: > Run with --stacktrace option to get the stack trace. > Run with --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. To increase the chances of successful build, before using menu “[LAMW] Build Android Apk and Run”, I am always deleting of all files in “build” directory. This slightly increases chances of successful build, however still often fails with error message listed above. Sometimes when deleting all files in “build” directory one file (classes.dex) cannot be deleted because file “classes.dex” is open in “Java(TM) Platform SE binary” (full path is: build\intermediates\dex\release\mergeDexRelease\classes.dex). I guess that “Java(TM) Platform SE binary” also locks some other files too and as the result building of app fails. I found workaround solution to this problem: before using menu “[LAMW] Build Android Apk and Run”, I launch Command Prompt as an administrator and then execute command Quotetaskkill /im java.exe /Fwhich forcefully terminates all “java.exe” processes . Does anybody have any ideas how to solve this problem without forcefully terminating “java.exe” process before every build of Android app? ---------------------------------------------------------------------- neuro · 2025-10-25 18:34 Quote from: neuro on October 21, 2025, 06:37:31 amDoes anybody have any ideas how to solve this problem without forcefully terminating “java.exe” process before every build of Android app? I have found a solution for crashing gradle build: Quotehttps://docs.gradle.org/current/userguide/performance.html#increa se_heap_size 8. Increase the Heap Size By default, Gradle reserves 512MB of heap space for your build, which is sufficient for most projects. However, very large builds may require more memory to store Gradle’s model and caches. If needed, you can increase the heap size by specifying the following property in the gradle.properties file in your project root or your Gradle home directory: gradle.properties org.gradle.jvmargs=-Xmx2048M For more details, see the JVM Memory Configuration documentation. I have added the line “org.gradle.jvmargs=-Xmx2048M“ to file “gradle.properties“ file and this has solved the problem of constantly crashing gradle build.