# Androidビルドメモリサイズ設定

Androidアプリをビルドする際のgradleの最大メモリ使用量を設定するプラグインです。

{% hint style="info" %}
このプラグインを使用するためには、対応するプランへの加入が必要となります。詳細は、 [料金プラン ](https://ja.monaca.io/pricing.html)をご確認ください。
{% endhint %}

## サポート対象のプラットフォーム

* Cordova 10 以降

## プラグインの追加方法

1. Monaca クラウド IDE か&#x3089;**`設定 → Cordova プラグインの管理`**&#x3092;選択します。
2. *利用可能なプラグイン* 項目の `MaxMemForAndroidBuild` プラグインにカーソルを置き、`有効`ボタンをクリックします。

## ビルド時の最大メモリサイズの設定

1. プロジェクトを開き、 `config.xml` を開きます。
2. Androidのビルド処理で使用する最大メモリサイズを4096Mbにする場合、次の様にして設定します。

   ```markup
      <preference name="monaca:jvmargs" value="-Xmx4096m"/>
   ```
3. このときGradle Daemonが利用する最大メモリサイズも合わせて変更する必要あり、例えば4Gにする場合、次の様にして設定します。

   ```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://ja.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.
