Video: Android Studio
Android Studio is an incredibly powerful piece of software. It has an editor with sophisticated code completion, and static analysis features. It also has a suite of tools for integrating with Android devices and emulators. The one thing it doesn't have, however, is an integrated build system. Android Studio delegates the entire build process to Gradle. That's everything that happens to turn your sources and resources into an APK that you can install on your device. Gradle itself doesn't inherently know anything about Android. That capability's provided by Google in the form of an Android Gradle plugin.
Android Studio is actually happy to import and work with any Gradle project. We can use it to do all sorts of interesting things, like build Java libraries or deploy a backend service to Google App Engine. Even though Android Studio isn't building your project, it still needs a deep model of your project, so it can provide features like code completion, and auto importing. It maintains its own internal model of your project, and when a project is loaded or a Gradle build script changes, Android Studio needs to synchronize its internal model with Gradle's model. When you get a "failed to sync" message, it usually means you've just got an error in one of your build scripts..