Gradle Plugin 和 Gradle的版本的需求

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 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=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
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值