Tip: Use local Gradle distribution instead of wrapper

The very first thing, that I’m doing after project import into Android Studio, is the switch from Gradle wrapper to local Gradle distribution. That have two benefits:

  • All projects can use same Gradle daemon.
    When you switch project A to project B and they have different gradle wrapper versions, Android Studio has to start different daemons. This can happen when you switch between different branches on the same project. Less daemons started in same time — less pressure on the system.
  • Bump Gradle version independently from the project.
    It takes time until new version propagates everywhere. All projects, all branches. Some teams are very fast in that, some are more conservative. With local distribution you can bump Gradle the same day stable version is released or even use release candidate version. One command and new version is applied to all your projects.

On Mac: brew install gradle

On Windows: download, unpack and install

Preferences in Android Studio

Open Preferences -> Build, Execution, Deployment -> Gradle. Select Use local gradle distribution and specify Gradle home.

On Mac: /usr/local/opt/gradle/libexec in case you installed it via brew.

For Windows: specify the path where you installed Gradle.

Just use gradle instead of ./gradlew. For example: gradle assembleDebug

Execute gradle --status