Premise Nate Ebel Jun 6, 2023

Using Gradle Enterprise to Detect Configuration Regressions in an Android Gradle Build

M2 Related OWASP risk: Inadequate Supply Chain Security Learn more →

Article Summary

Premise's mobile team caught a sneaky 3x build time regression that only showed up in CI. Here's how they hunted it down using Gradle Enterprise.

Android engineer Nate Ebel walks through a real debugging case study where PR builds suddenly slowed by 20%. The culprit? An AGP update that silently downloaded a 2GB NDK on every CI run.

Key Takeaways

Critical Insight

By consolidating NDK versions in a precompiled script plugin and monitoring configuration time, Premise eliminated a hidden regression that was costing 20% on every PR build.

The team also discovered why local builds weren't affected while CI was suffering, revealing a critical difference in how development machines handle NDK installations.

About This Article

Problem

Premise's PR builds got 20% slower in GitHub Actions CI due to Gradle configuration time tripling, but local builds stayed fast. This made it hard to track down without proper monitoring in place.

Solution

Nate Ebel's team dug into Gradle Enterprise buildscan logs and found that AGP was downloading a 2GB NDK version during configuration. The NDK version wasn't pinned consistently across modules, so they fixed it with a precompiled script plugin that standardized the versioning.

Impact

After pinning the NDK version and setting up automated monitoring through scheduled GitHub Actions workflows, Premise stopped the slowdown and caught similar configuration regressions before they made it into code review.