# Android build memory size setting

This plugin sets the maximum memory usage for Gradle when building Android apps.

{% hint style="info" %}
In order to use this plugin, you are required to subscribe to a valid plan. Please refer to [Monaca Subscription Plans ](https://monaca.mobi/en/pricing).
{% endhint %}

## Supported Platforms

* Cordova 10 or higher

## How to Add Plugin

1. From Monaca Cloud IDE menu, go to `Configure → Cordova Plugin Settings`.
2. Under *Available Plugins* section, hover over the the `MaxMemForAndroidBuild` plugin and click `Enable` button.

## Setting the maximum memory size at build time

1. Open the project and open `config.xml`.
2. If you want to set the memory size used in the Android build process to 4096Mb, you can do so as follows

   ```markup
      <preference name="monaca:jvmargs" value="-Xmx4096m"/>
   ```
3. Then you also need to change the maximum memory size used by Gradle Daemon, for example, if you want to set it to 4G, set it as follows

   ```markup
      <preference name="monaca:env:GRADLE_OPTS" value="-Dorg.gradle.jvmargs='-Xmx4G'"/>
   ```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://en.docs.monaca.io/reference/power_plugins/android_build_mem.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
