Change to
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
in file gradle-wrapper.properties, and then change to
classpath 'com.android.tools.build:gradle:4.0.1'
in file build.gradle (Project)
classpath 'com.android.tools.build:gradle:4.2.0'
distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-all.zip
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.0.1'
changing the 'gradle-wrapper.properties' and 'build.gradle' may work but if
app is build with latest config which isn't supported by android studio then
syntax and type errors may occur so instead always try to be on the latest
version of android studio to keep on the same platform.