Android Studio gradle插件版本和gradle版本对应关系
sourceSets {
main {
jniLibs.srcDirs = ['libs']
res.srcDirs =
['src/main/res',
'src/main/res/layout',
'src/main/res/mipmap-xxhdpi',
'src/main/res/layout/activity',
'src/main/res/layout/fragment',
'src/main/res/layout/item',
'src/main/res/layout/cell',
'src/main/res/layout/dialog',
'src/main/res/layout/view',
'src/main/res/layout/placeview',
'src/main/res/layout/include',
'src/main/res/layout/title',
'src/main/res/mipmap-xxhdpi/user',
'src/main/res/mipmap-xxhdpi/medicinechina',
'src/main/res/mipmap-xxhdpi/medicinewestern',
'src/main/res/mipmap-xxhdpi/splash'
]
}
}
android {
buildToolsVersion "27.0.3"
compileSdkVersion 24
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
androidTest.setRoot('tests')
}
}
...
gradle版本4.6-all.zip: distributionUrl = https\://services.gradle.org/distributions/gradle-4.6-all.zip
对应的是 the plugin to version 3.2.1: classpath 'com.android.tools.build:gradle:3.2.1'
...
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
1、gradle插件版本配置位置:
project对应的build.gradle文件中
buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } }
2、gradle版本配置位置:
gradle/wrapper/gradle-wrapper.properties文件中
distributionUrl=http\://services.gradle.org/distributions/gradle-3.3-all.zip
3、版本对应关系如下
官网链接:https://developer.android.google.cn/studio/releases/gradle-plugin.html#updating-plugin