LoginSignup
11
12

More than 5 years have passed since last update.

Gradle でビルド中、ProGuard がヒープ不足で落ちるときの対処法

Posted at

現象

それなりに大きなモジュールだったり、モジュールが参照するモジュールがたくさんあったりすると、ProGuard が頑張らないといけないことが多くなるので、その分 Java のヒープを食います。

そうすると、いつかヒープが足らなくなり、以下のようにエラーを吐いてビルドがコケるようになります。


:MyApplication:proguardProductionRelease
Note: there were 979 duplicate class definitions.
:MyApplication:proguardProductionRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':NohanaPhotoBook:proguardProductionRelease'.
> Java heap space

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

回避策

ヒープを大きくしましょう。

export GRADLE_OPTS=-Xmx2048m
11
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
12