Android Studio 与 Gradle 版本对应
如果不对应可能会报如下错误:
Cause: org.jetbrains.plugins.gradle.tooling.util.ModuleComponentIdentifierImpl.getModuleIdentifier() 
- Android Studio v 3.1.4 对应的 gradle 为 4.6 
- Android Studio v 3.4.1 对应的 gradle 为 5.1.1 
- /gradle/wrapper/gradle-wrapper.properties 会指明用哪个gradle版本,并自动下载
| 1
 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
 | 
如果网络问题,可以使用阿里云镜像
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 
 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
 buildscript {
 repositories {
 //google()
 //jcenter()
 maven { url 'https://maven.aliyun.com/repository/google' }
 maven { url 'https://maven.aliyun.com/repository/jcenter' }
 maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
 }
 
 dependencies {
 classpath 'com.android.tools.build:gradle:3.2.0'
 
 // NOTE: Do not place your application dependencies here; they belong
 // in the individual module build.gradle files
 }
 }
 
 allprojects {
 repositories {
 //google()
 //jcenter()
 maven { url 'https://maven.aliyun.com/repository/google' }
 maven { url 'https://maven.aliyun.com/repository/jcenter' }
 maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }
 }
 }
 
 task clean(type: Delete) {
 delete rootProject.buildDir
 }
 
 |