Configuring Gradle for Android Development

Solutions for common Gradle issues faced in Android development for beginners

Configuring Gradle for Android Development
Photo by Denny Müller / Unsplash

Android Gradle Plugin and compatible Gradle Version
Gradle Plugin

Gradle

  • android/gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip

Change of Version

remove folder ~/.gradle and reopen Android Studio to trigger auto rebuild

Android Gradle Plugin (AGP)

buildscript {
    ...
    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
    }
}

the two versions (e.g. 7.6.1 and 7.4.2) must be compatible to build correctly

Proxy

follows the proxy setting configured in Android Studio

  • Preferences | Appearance & Behavior | System Settings | HTTP Proxy

Java Compatibility

Kotlin Compatibility