ビルド時間を計測・比較したいときの gradle(w) オプション

Terminal 開いてから。


./gradlew --profile --offline --rerun-tasks --max-workers=4 assembleDebug

👉 Compose におけるデベロッパーのエルゴノミクス  |  Jetpack Compose  |  Android Developers hatena-bookmark

結果がHTMLで出力されます。

Profile report Profiled build: assembleDebug

各オプションの意味については以下。

--profile
Generates a high-level performance report in the $buildDir/reports/profile directory. --scan is preferred.

--offline
Specifies that the build should operate without accessing network resources.

--rerun-tasks
You can force Gradle to execute all tasks ignoring up-to-date checks

--max-workers
Sets maximum number of workers that Gradle may use. Default is number of processors.

👉 Command-Line Interface hatena-bookmark

実行前にクリーンするのがいいそうです。


// On Mac or Linux, run the Gradle wrapper using "./gradlew".
gradlew clean

gradlew --profile --offline --rerun-tasks assembleFlavorDebug

👉 ビルドのプロファイリングを行う  |  Android デベロッパー  |  Android Developers hatena-bookmark


./gradlew clean && ./gradlew --profile --offline --rerun-tasks --max-workers=4 assembleDebug

10回やってみてどうなるか。

ある平均的なぶれのないビルド時間になりますかね。