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.gradlefiles. - 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
- "Sync Now" link: after you change
build.gradle, a notification appears at the top of the editor with a "Sync Now" option. Click it. - Main menu: open
Fileand selectSync Project with Gradle Files. - 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:
cdinto your Android project directory.- Run
./gradlew taskson Unix-based systems (gradlew taskson 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.
| Step | Action |
| Push Changes | Modify your build.gradle files as needed. |
| Sync Prompt | "Sync Now" appears in the editor toolbar. |
| File Menu | Navigate to File → Sync Project with Gradle Files. |
| Gradle Tool | Use the Gradle Tool window’s refresh button. |
| Command Line | Execute ./gradlew tasks in the terminal. |
Related reading
- Android Studio Stuck at Gradle Download on create new project
- Android Studio suddenly cannot resolve symbols
- Android Studio was unable to find a valid Jvm Related to MAC OS
- Android TensorFlow Lite interpreter How to fix DataType error cannot resolve DataType of java.lang.Float
- Android Studio How to uninstall APK or execute adb command automatically before Run or Debug?
- Android Studio installation on Windows 7 fails, no JDK found
- Android Timer schedule vs scheduleAtFixedRate
- Android Why can't I create a handler in new thread

OOD Fundamentals
Master object-oriented design from first principles, SOLID, design patterns, and classic interview problems with hands-on coding.
View the courseData 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.