Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

build error

A topic by Volarate2026 created 2 days ago Views: 19 Replies: 1
Viewing posts 1 to 2

Subject: Bug Report: Gradle OOM error and hardcoded -Xmx2gin gradle.properties(v1.4 offline)

I am using AG APK Builder v1.4 (offline version) to package an encrypted RPG Maker MV game into APK.

Problem:

The build always fails at :app:signReleaseBundlewith OutOfMemoryError: Java heap space.

Root cause I identified:

Every time I click Build, the software regenerates resources/base_module/gradle.propertieswith

org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m 

Even if I manually change it to -Xmx8gor -Xmx10g, it gets overwritten back to -Xmx2gwhen building starts.

My machine has 32GB RAM, so memory is not the issue — the hardcoded limit is.

What I tried (but didn't work):

  • Manually editing gradle.properties→ overwritten by the tool

  • Editing gradlew.bat→ likely not used by the Electron wrapper

  • Looking for a config file or UI setting for Gradle heap size → none exists

build log:

[19:49:35] Building APK...

[19:49:35] PAD: OFF | minSdk: 21 | targetSdk: 34 | Orient: landscape

[19:49:35] Output: Documents/AG APK BUILDER (default)

[19:49:35] [AdMob] Disabled — build tanpa monetisasi

[19:49:35] [AGNotification] Disabled — build tanpa notifikasi

[19:49:35] [AGJoystick] Disabled — build tanpa virtual joystick

[19:49:35] [Java] Using: D:\AG-APK-Builder-v1-4\resources\jre

[19:49:35] [AdMob] Toggle disabled — AdMob is not used.

[19:49:35] [AGNotification] Toggle nonaktif — Notification tidak digunakan.

[19:49:35] [AGJoystick] Toggle nonaktif — Joystick tidak digunakan.

[19:49:35] [AGPay] AGPay.js tidak ditemukan — AGPay nonaktif.

[19:49:35] [Build] AdMob : disabled

[19:49:35] [Build] Notif : disabled

[19:49:35] [Build] Joystick : disabled

[19:49:35] [Build] AGPay : disabled

[19:49:35] [Build] PAD : disabled

[19:49:35] [Build] Orient. : landscape

[19:49:35] Preparing environment... (AGP 8.3.2)

[19:49:38] [Gradle] wrapper → gradle-8.7-bin.zip (absolute file:///)

[19:49:38] [AGP] Memeriksa AGP & Kotlin plugin cache...

[19:49:38] OK gradle (cached)

[19:49:38] OK gradle-api (cached)

[19:49:38] OK builder (cached)

[19:49:38] OK builder-model (cached)

[19:49:38] OK com.android.application.gradle.plugin (cached)

[19:49:38] OK org.jetbrains.kotlin.android.gradle.plugin (cached)

[19:49:38] OK kotlin-gradle-plugin (cached)

[19:49:38] [AGP] Semua plugin siap. Build akan jalan offline.

[19:49:38] Injecting www...

[19:49:38] [Java] MainActivity.java written (Standard)

[19:49:53] Updating strings.xml...

[19:49:53] Patching manifest...

[19:49:53] [Orientation] screenOrientation set to: landscape

[19:49:53] Processing icons...

[19:49:53] Updating Gradle...

[19:49:53] [Gradle] compileSdk=35, targetSdk=34

[19:49:53] Running Gradle bundleRelease...

[19:49:55] To honour the JVM settings for this build a single-use Daemon process will be forked. For more on this, please refer to https://docs.gradle.org/8.7/userguide/gradle_daemon.html#sec:disabling_the_daemo... in the Gradle documentation.

[19:49:56] Daemon will be stopped at the end of the build

[19:50:06] > Task :app:preBuild UP-TO-DATE > Task :app:preReleaseBuild UP-TO-DATE

[19:50:06] > Task :app:generateReleaseResValues

[19:50:07] > Task :app:mapReleaseSourceSetPaths

[19:50:07] > Task :app:generateReleaseResources

[19:50:09] > Task :app:createReleaseCompatibleScreenManifests > Task :app:extractDeepLinksRelease

[19:50:09] > Task :app:processReleaseMainManifest

[19:50:09] > Task :app:processReleaseManifest

[19:50:09] > Task :app:processApplicationManifestReleaseForBundle

[19:50:09] > Task :app:checkReleaseAarMetadata > Task :app:packageReleaseResources

[19:50:09] > Task :app:parseReleaseLocalResources > Task :app:extractReleaseVersionControlInfo

[19:50:10] > Task :app:checkReleaseDuplicateClasses

[19:50:10] > Task :app:buildKotlinToolingMetadata > Task :app:checkKotlinGradlePluginConfigurationErrors

[19:50:10] > Task :app:processReleaseManifestForPackage > Task :app:javaPreCompileRelease > Task :app:desugarReleaseFileDependencies

[19:50:10] > Task :app:mergeReleaseShaders

[19:50:10] > Task :app:compileReleaseShaders NO-SOURCE > Task :app:generateReleaseAssets UP-TO-DATE

[19:50:10] > Task :app:mergeReleaseResources

[19:50:15] > Task :app:mergeExtDexRelease

[19:50:16] > Task :app:mergeReleaseAssets

[19:50:16] > Task :app:mergeReleaseJniLibFolders

[19:50:16] > Task :app:mergeReleaseNativeLibs NO-SOURCE > Task :app:stripReleaseDebugSymbols NO-SOURCE

[19:50:16] > Task :app:writeReleaseAppMetadata > Task :app:mergeReleaseArtProfile

[19:50:16] > Task :app:collectReleaseDependencies > Task :app:configureReleaseDependencies > Task :app:extractReleaseNativeSymbolTables NO-SOURCE > Task :app:parseReleaseIntegrityConfig UP-TO-DATE > Task :app:validateSigningRelease

[19:50:18] > Task :app:processReleaseResources

[19:50:18] > Task :app:compileReleaseKotlin NO-SOURCE

[19:50:19] > Task :app:bundleReleaseResources

[19:50:19] > Task :app:compileReleaseJavaWithJavac

[19:50:19] ע: D:\AG-APK-Builder-v1-4\resources\base_module\app\src\main\java\com\mygame\hills\MainActivity.javaʹ�û򸲸����ѹ�ʱ�� API�� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣

[19:50:20] > Task :app:dexBuilderRelease

[19:50:20] > Task :app:mergeReleaseGlobalSynthetics > Task :app:processReleaseJavaRes

[19:50:21] > Task :app:mergeReleaseJavaResource

[19:50:22] > Task :app:mergeDexRelease

[19:50:29] > Task :app:buildReleasePreBundle

[19:50:30] > Task :app:compileReleaseArtProfile

[19:50:41] > Task :app:packageReleaseBundle

[19:50:48] Exception in thread "Daemon client event forwarder" java.lang.OutOfMemoryError: Java heap space at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1661) at java.base/java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:460) at org.gradle.launcher.daemon.server.exec.DaemonConnectionBackedEventConsumer$ForwardEvents.getNextEvent(DaemonConnectionBackedEventConsumer.java:72) at org.gradle.launcher.daemon.server.exec.DaemonConnectionBackedEventConsumer$ForwardEvents.run(DaemonConnectionBackedEventConsumer.java:59)

[19:50:48] > Task :app:signReleaseBundle FAILED

[19:50:49] FAILURE:

[19:50:49] Build failed with an exception.

[19:50:49] * What went wrong: Execution failed for task ':app:signReleaseBundle'. > A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable

[19:50:49] * 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 54s

[19:50:49] 41 actionable tasks: 40 executed, 1 up-to-date

[19:50:49] [ERROR] CMD FAILED exit code 1

[19:50:52] [ERROR] Build failed: Error invoking remote method 'build-apk': Error: CMD FAILED exit code 1

thanks !!

Developer

Yo! Thanks a lot for reporting this. 😭🙏


Turns out this was a pretty sneaky bug. I couldn't reproduce it on my end because my potato dev PC only has 8 GB RAM. 

I've made a small fix for it.

 Just extract fix-jvm.rar and replace the files inside your app folder with the ones from the archive.


If it still throws a Java heap space error, open patch-gradle-jvm.js and increase the JVM memory to match your PC. For example:

  • 16 GB RAM → Xmx: '4g'
  • 32 GB RAM → Xmx: '8g'

Hopefully this yeets the bug for good. 

Thanks again for catching this one! You're amazing.