title: How to stop Android Studio from running my gradle task when syncing project with Gradle files?
body: <p>From the <a href="https://developer.android.com/studio/build/#sync-files" rel="nofollow noreferrer">docs</a>,</p>
  <blockquote>
  <p>When you make changes to the build configuration files in your
  project, Android Studio requires that you sync your project files so
  that it can import your build configuration changes and run some
  checks to make sure your configuration won't create build errors.</p>
  </blockquote>
  <p>my <strong>build.gradle</strong> for app:</p>
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      //...  &lt;--modified here
  }
  
  task myTask() {
      println 'doing something...'
      //time-consuming operations which may takes 16s or more
      println 'done'
  }
  </code></pre>
  <p>I just found that it runs <code>myTask</code> every time I modified the <code>build.gradle</code> for app, even if I didn't change it.</p>
  <p>Is that a normal operation when <em>running some checks to make sure your configuration won't create build errors</em>? If that is, how can I make the task not run when syncing?</p>
  <p><strong>Environment</strong>:<br />
  Android Studio 3.1.3 with gradle-4.9-bin.zip</p>