Desik
Desik

Reputation: 635

Android Studio - disable gradle sync

Every time I load Android Studio (1.5), it runs gradle sync, even though nothing has changed since the last run. The funny thing is that a project that sync-ed properly yesterday will fail for random reasons today. Such as "Error:Cause: peer not authenticated" or "Could not reserve enough space for object heap".

Could I disable automatic gradle sync at startup?

Upvotes: 13

Views: 20803

Answers (4)

Tamim Attafi
Tamim Attafi

Reputation: 2521

The problem

My gradle kept syncing files automatically whenever I changed something to my build.gradle, this became so annoying since it doesn't give you the chance to finish writing something before switching you to another tab.

None of the answers above helped me, so I updated my version from Android Studio Electric Eel | 2022.1.1 Patch 2 to Android Studio Flamingo | 2022.2.1 and still had the issue.

The option Synchronize files on frame or editor tab activation under Settings -> Appearance & Behavior -> System Settings is mussing in these new versions.

The Solution

It seems like the new Android Studio versions have a bug that was causing this issue. So in order to fix it, follow these steps:

  1. Open your gradle side panel (Right side)

  2. Click on the three dots to show more options

  3. Click on Auto-Reload Settings enter image description here

  4. Check the option Reload project after changes in the build scripts

  5. Check the option External changes enter image description here

  6. Uncheck the option Reload project after changes in the build scripts enter image description here

You can find this option under Settings -> Build, Execution, Deployment -> Build Tools

Or if you are using MacOS Preferences -> Build, Execution, Deployment -> Build Tools

Restart Android Studio

Happy Coding!

Upvotes: 0

Mick
Mick

Reputation: 666

EDIT: It looks like this feature has been removed in the latest versions.

This is a little late, but for anyone else looking:

In "Settings" -> "Appearance & Behavior" -> "System Settings"

Uncheck "Synchronize files on frame or editor tab activation"

You'll have to remember to hit the "Sync Project with Gradle Files" button whenever you make changes to Gradle. (To the left of AVD Manager)

Upvotes: 16

Ikram
Ikram

Reputation: 51

You can disable auto sync using below steps

Settings -> Appearance & Behavior -> System Settings Uncheck Synchronize files on frame or editor tab activation

Upvotes: 2

Kshitiz Sharma
Kshitiz Sharma

Reputation: 18627

You can disable autoimport in Settings (Preferences) > Build... > Build Tools > Gradle

See How to disable automatic gradle builds?

Upvotes: 1

Related Questions