Android Studio Gradle Sync Failed
Quick answer
Gradle sync fails when the JDK, Gradle, Android Gradle plugin (AGP) or network setup does not match. Check the real error in the Build tab, then fix the Gradle JDK or versions, and re-sync.
Most likely fix: Read the actual error first
How to fix it
Try these in order — the most common fix is first.
1. Read the actual error first
- Open the Build tool window (View > Tool Windows > Build) after the failed sync
- Click the first error line, not the generic 'sync failed' banner
- Search for the exact message; the cause is usually a JDK, version or network error
Did this fix it?2. Set the correct Gradle JDK
- Open File > Settings > Build, Execution, Deployment > Build Tools > Gradle (Android Studio > Settings on macOS)
- Set Gradle JDK to GRADLE_LOCAL_JAVA_HOME or the bundled jbr-17 (AGP 8.x needs 17)
- Click Apply, then Sync Project with Gradle Files
Did this fix it?3. Check repositories and offline mode
- In settings.gradle(.kts), make sure pluginManagement and dependencyResolutionManagement list google() and mavenCentral()
- In the Gradle settings page, make sure Offline mode is unchecked
- Re-sync
Did this fix it?4. Fix network or proxy blocks
- Settings > Appearance & Behavior > System Settings > HTTP Proxy: set your proxy or auto-detect
- For 'Permission denied: connect', add -Djava.net.preferIPv4Stack=true to org.gradle.jvmargs in gradle.properties and restart Android Studio
- Sync again
Did this fix it?5. Clear caches
- File > Invalidate Caches > Invalidate and Restart
- If it still fails, close the IDE and delete the project's .gradle and build folders, then reopen and sync
Did this fix it?
Symptoms
A red 'Gradle sync failed' banner or 'Gradle project sync failed' message in the Build tool window, often with an unresolved dependency or plugin error.
Why it happens
- Gradle JDK older than what the Android Gradle plugin requires (AGP 8.x needs JDK 17)
- AGP, Gradle and Android Studio versions that are not compatible
- Missing google() or mavenCentral() repository
- Proxy, firewall or IPv6 problems blocking dependency downloads
- Corrupt Gradle cache or stale IDE caches
This guide also covers
- gradle sync failed android studio
- android studio gradle project sync failed
- android studio sync failed fix
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 usThe same problem in other apps
- IntelliJ IDEA Gradle Sync Failed (JetBrains IntelliJ)
Other Android Studio errors
- 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 Gradle Build Slow
- Android Studio SDK Location Not Found
- Android Studio Build Failed: JDK, Gradle or AGP Version Mismatch