Android Studio Gradle Build Slow
Quick answer
Slow Gradle builds are usually memory, configuration or cache problems. Raise org.gradle.jvmargs, enable the configuration cache, use KSP instead of kapt and run Build Analyzer to find the bottleneck.
Most likely fix: Run Build Analyzer
How to fix it
Try these in order — the most common fix is first.
1. Run Build Analyzer
- View > Tool Windows > Build, then open the Build Analyzer tab
- If garbage collection takes over 15% of build time, raise the heap
Did this fix it?2. Raise the Gradle heap
- In gradle.properties set org.gradle.jvmargs=-Xmx6g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g
- Google recommends explicit MaxMetaspaceSize because of Gradle issue 19750
- Measure before and after
Did this fix it?3. Enable the configuration cache
- Add org.gradle.configuration-cache=true to gradle.properties
- Use Build Analyzer to check plugin compatibility first
Did this fix it?4. Cut unnecessary work
- Migrate from kapt to KSP where libraries support it
- Use static dependency versions (no '+')
- Set android.enableJetifier=false if no old support libraries remain
- Keep AGP and Android Studio up to date
Did this fix it?5. Windows antivirus exclusions
- Exclude the .gradle folder, project folder and SDK folder from real-time scanning
Did this fix it?
Symptoms
Builds take minutes, sync is slow, or Gradle runs out of memory with 'Daemon disappeared' or 'GC overhead' errors.
Why it happens
- Gradle heap too small, so garbage collection dominates the build
- Configuration cache and build cache off
- kapt in use instead of KSP
- Dynamic dependency versions that force update checks
- Antivirus scanning build output (Windows)
- Jetifier still enabled
This guide also covers
- android studio gradle build slow
- speed up gradle build android
- gradle build taking forever android studio
- gradle daemon disappeared android studio
Still not working?
If Android Studio keeps failing, you're not alone. See every Android Studio problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usOther Android Studio errors
- Android Studio Gradle Sync Failed
- Android Studio Emulator Not Starting
- Android Emulator HAXM / Hypervisor Error (VT-x, WHPX, AEHD)
- Android Studio Emulator Slow or Laggy
- Android Studio Device Offline or Not Detected (ADB)
- Android Studio Slow and Using Too Much RAM
- Android Studio SDK Location Not Found
- Android Studio Build Failed: JDK, Gradle or AGP Version Mismatch