Skip to content

Androidビルド速度を最適化するためGradle設定を調整 - #5408

Merged
TinyKitten merged 1 commit into
devfrom
claude/optimize-android-build-speed-M604O
Feb 22, 2026
Merged

TinyKitten merged 1 commit into
devfrom
claude/optimize-android-build-speed-M604O

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Feb 22, 2026 •

Copy link
Copy Markdown
Member

Summary

EASでのAndroidビルドがiOS(約14分)に比べて約24分と遅いため、android/gradle.properties のGradle設定を最適化しました。

変更内容と期待される効果

1. ネイティブアーキテクチャを arm64-v8a のみに削減(最大の効果)

  • 変更前: armeabi-v7a,arm64-v8a,x86,x86_64(4アーキテクチャ)
  • 変更後: arm64-v8a(1アーキテクチャ)
  • 理由: EASビルドで生成するAABはPlay Storeが端末ごとに最適なAPKを配信するため、arm64-v8a のみで十分です。x86/x86_64 はエミュレータ専用、armeabi-v7a は32bitレガシーデバイス向けで現在のユーザーベースではほぼ不要です。
  • 期待効果: ネイティブコンパイル時間が約75%短縮。ローカルでエミュレータ向けにビルドする場合は -PreactNativeArchitectures=x86_64 で上書き可能です。

2. JVMヒープ増加とGC最適化

  • 変更前: -Xmx2048m
  • 変更後: -Xmx4096m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC
  • 理由: 並列ビルド時にメモリが逼迫するとGCが頻発してビルドが遅くなります。ヒープを倍増し、ParallelGCでスループットを向上させます。

3. Gradleビルドキャッシュの有効化

  • 追加: org.gradle.caching=true
  • 理由: 同一ビルド内でもタスク出力をキャッシュし、再利用可能なタスクをスキップします。

4. PNGクランチの無効化

  • 変更前: android.enablePngCrunchInReleaseBuilds=true
  • 変更後: android.enablePngCrunchInReleaseBuilds=false
  • 理由: AAB配布ではPlay Storeがビルド時に画像最適化を行うため、ビルド側での処理は不要です。

Regression risk assessment

  • アーキテクチャ削減により32bitデバイス(armeabi-v7a)およびx86デバイスではPlay Storeからインストールできなくなりますが、現在のユーザーベースではほぼ影響なし
  • PNG圧縮無効化はPlay Storeによる配信時最適化でカバーされるため品質への影響なし
  • JVM設定変更はEASビルドマシン(8GB+ RAM)では問題なし

Test plan

  • EASでdevelopmentプロファイルのAndroidビルドを実行し、ビルド時間の短縮を確認
  • 生成されたAABが正常にPlay Storeにアップロードできることを確認
  • ローカルでエミュレータ向けビルド時に -PreactNativeArchitectures=x86_64 で上書きできることを確認

https://claude.ai/code/session_01VUGJtVwbG5uzxLTSgFNJ5G

Summary by CodeRabbit

リリースノート

  • Chores
    • ビルド性能を最適化するため、Gradleの設定を改善しました。
    • ビルドキャッシュを有効化し、ビルド時間を短縮します。
    • Play Store配布用に対応アーキテクチャを調整しました。

@coderabbitai

coderabbitai Bot commented Feb 22, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

ウォークスルー

Android プロジェクトの Gradle 設定を最適化するため、JVM ヒープサイズを 2GB から 4GB に増加し、Gradle ビルドキャッシングを有効化しました。また、PNG クランチングを無効化し、React Native ビルドの対応アーキテクチャを arm64-v8a に限定して Play Store AAB ビルドの効率性を向上させました。

変更内容

Cohort / File(s) Summary
Gradle 設定最適化
android/gradle.properties
JVM ヒープを -Xmx2048m から -Xmx4096m に増加し、ヒープダンプとパラレルガベージコレクションを有効化。Gradle キャッシングを有効化 (org.gradle.caching=true)。AAPT2 PNG クランチングを無効化。React Native 対応アーキテクチャを arm64-v8a のみに限定し、ローカルエミュレーション上書きのための説明コメント (日本語) を追加。

推定レビュー工数

🎯 1 (Trivial) | ⏱️ ~3 minutes

関連する可能性のあるプルリクエスト

  • PR #4287: android/gradle.properties の org.gradle.jvmargs 設定を変更しており、JVM ヒープサイズ調整に関連している。
  • PR #4347: android/gradle.properties を修正して Gradle デーモンの JVM ヒープを -Xmx4096m に増加させており、同じ設定変更が含まれている。

提案ラベル

android, ci/cd

ポエム

🐰 Gradle のメモリを増やしてね、
キャッシュで高速化、ARM に絞って、
ビルドはスムーズ、素早く完成!
日本語のコメント添えて、
開発者の心遣い ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRのタイトルはAndroidビルド速度最適化のためのGradle設定調整という主要な変更内容を明確に要約しており、ファイルの変更内容(JVMヒープ、キャッシング、PNG圧縮、アーキテクチャ設定)と合致している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/optimize-android-build-speed-M604O

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@android/gradle.properties`:
- Line 13: The org.gradle.jvmargs setting currently forces a 4GB heap
(-Xmx4096m) which can fail on low-memory CI/dev machines; change this to a safer
default (e.g. -Xmx1536m or -Xmx2048m) or make it overridable by environment/CI
(use GRADLE_OPTS or read a project property) so CI can supply a larger value
when available; update the org.gradle.jvmargs entry to a lower default and
document/allow overriding in CI by referencing the org.gradle.jvmargs key.
- Around line 34-36: The gradle property reactNativeArchitectures is hard-set to
"arm64-v8a", which excludes x86/x86_64 and 32-bit devices for all builds; change
the configuration so it's not globally fixed—either remove or unset the
reactNativeArchitectures entry from gradle.properties and rely on passing
-PreactNativeArchitectures=arm64-v8a only during CI release builds (or set a
neutral default like empty) so local/emulator and 32-bit builds still work;
update any CI build scripts to inject -PreactNativeArchitectures=arm64-v8a for
Play Store AAB releases and leave the reactNativeArchitectures property unset
for development.

Comment thread android/gradle.properties Resolved
Comment thread android/gradle.properties Resolved
@TinyKitten
TinyKitten merged commit e7a6d0e into dev Feb 22, 2026
4 checks passed
@TinyKitten
TinyKitten deleted the claude/optimize-android-build-speed-M604O branch February 22, 2026 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants