Android Studio
Gradle Sync
Manual Gradle Sync
Android Development
Gradle Tips

How to run Gradle sync manually in Android Studio

Codemia Knowledge Hub ·

To run a Gradle sync manually in Android Studio, choose File > Sync Project with Gradle Files. You can also click the "Sync Now" link that appears after you edit a build.gradle file, or press "Refresh" in the Gradle tool window.

A Gradle sync re-reads your build.gradle files and dependencies and reconfigures the project to match, so the IDE's view of the project setup and dependencies stays in line with the build files. That avoids problems at build time after the build configuration changes.

When to sync manually

Android Studio usually prompts for a sync when it detects changes, but you may need to start one yourself:

  • After updating or adding dependencies in build.gradle files.
  • When the IDE does not pick up configuration changes automatically.
  • After importing a project, to make sure every dependency is downloaded and configured.
  • When resolving missing dependencies or incorrect build configurations.

Ways to start a sync

From the Android Studio UI

  1. "Sync Now" link: after you change build.gradle, a notification appears at the top of the editor with a "Sync Now" option. Click it.
  2. Main menu: open File and select Sync Project with Gradle Files.
  3. Gradle tool window: open the Gradle tool window from the tab on the right side of Android Studio and click "Refresh".

From the command line

This is useful for scripts and automation:

  1. cd into your Android project directory.
  2. Run ./gradlew tasks on Unix-based systems (gradlew tasks on Windows). This initializes Gradle so you can confirm the configuration changes.

When the sync fails

  • Clear caches: go to File > Invalidate Caches / Restart. Clearing the Android Studio cache can fix plugin-related problems.
  • Check the network: an unstable connection can stop dependencies from downloading.
  • Verify repositories: make sure the correct repositories are listed in build.gradle.
  • Fix Gradle or wrapper errors: use a Gradle version compatible with your Android Studio, and update it if necessary in the project's gradle-wrapper.properties.
StepAction
Push ChangesModify your build.gradle files as needed.
Sync Prompt"Sync Now" appears in the editor toolbar.
File MenuNavigate to File → Sync Project with Gradle Files.
Gradle ToolUse the Gradle Tool window’s refresh button.
Command LineExecute ./gradlew tasks in the terminal.

Course
Intermediate
27 lessons
14 hours
OOD Fundamentals

Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.

View the course
Data Structures & Algorithms practice on Codemia

Step through 300+ coding interview problems with animated visualisers that show the data structure changing as the code runs. The Blind 75 are free.

Practice algorithms