Gradle Plugin 和 Gradle的版本的需求

来源:互联网 发布:php prematch 编辑:程序博客网 时间:2024/06/06 01:38

GradlePlugin Gradle的版本的需求

 

例如这里如果plugin2.3.0的那么Gradle就至少是3.3

参考官方网站,选择合适的https://developer.android.com/studio/releases/gradle-plugin.html#updating-plugin

Plugin version

Required Gradle version

1.0.0 - 1.1.3

2.2.1 - 2.3

1.2.0 - 1.3.1

2.2.1 - 2.9

1.5.0

2.2.1 - 2.13

2.0.0 - 2.1.2

2.10 - 2.13

2.1.3 - 2.2.3

2.14.1+

2.3.0+

3.3+

 

参考: Androidgradle手动下载(注意不是Android Gradle Plugin

下载地址就是这个:https://services.gradle.org/distributions/

 

 

 

如果工程\gradle\wrapper\gradle-wrapper.properties中配置如下:

#Mon Dec 28 10:00:20 PST 2015distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/distszipStoreBase=GRADLE_USER_HOMEzipStorePath=wrapper/distsdistributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

 

则工程\build.gradle下的文件内容如下:

buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:2.3.3'    }}allprojects {    repositories {        jcenter()    }}task clean(type: Delete) {    delete rootProject.buildDir}

 

 

 

也就是这个gradle客户端插件的版本需要与gradle的版本对应起来,这里插件版本使用的是2.3.3对应的gradle版本就是3.3.如果不对应则会提示出下错误:

Error:Unable to find method'com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V'.

Possible causes for this unexpected errorinclude:<ul><li>Gradle's dependency cache may be corrupt (thissometimes occurs after a network connection timeout.)

<ahref="syncProject">Re-download dependencies and sync project(requires network)</a></li><li>The state of a Gradle buildprocess (daemon) may be corrupt. Stopping all Gradle daemons may solve thisproblem.

<ahref="stopGradleDaemons">Stop Gradle build processes (requiresrestart)</a></li><li>Your project may be using a third-partyplugin which is not compatible with the other plugins in the project or theversion of Gradle requested by the project.</li></ul>In the case ofcorrupt Gradle processes, you can also try closing the IDE and then killing allJava processes.

阅读全文
0 0