Basta cambiare il file gradle-wrapper.properties (sotto l'immagine)
A questo (se il tuo gradle è com.android.tools.build:gradle:3.0.1
)
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip // this version or above|
Per gradle
com.android.tools.build:gradle:3.2.1
Usa questo
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
AGGIORNARE
Per i seguenti gradi
com.android.tools.build:gradle:3.0.1
com.android.tools.build:gradle:3.1.0
com.android.tools.build:gradle:3.2.1
com.android.tools.build:gradle:3.3.2
com.android.tools.build:gradle:3.4.0
com.android.tools.build:gradle:3.5.0
Usa i seguenti URL
distributionUrl=https\:
distributionUrl=https\:
distributionUrl=https\:
distributionUrl=https\:
distributionUrl=https\:
distributionUrl=https\:
Non dimenticare di aggiungere i google()
repository buildscript.