Gradle 3.3 版不支持 BuildActionExecuter 上的 forTask() 方法 [英] Gradle version 3.3 does not support forTask() method on BuildActionExecuter

查看:31
本文介绍了Gradle 3.3 版不支持 BuildActionExecuter 上的 forTask() 方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我的 Android Studio 更新到了 3.0 canary 1.现在我正在 Android Studio 3.0 canary 1 上处理我现有的项目.默认情况下,gradle:3.0.0-alpha1 在我的项目中设置:gradle_file.所以我将我的 gradle 版本更改为 2.2.3,现在我收到了这个错误:

I just updated my Android Studio to 3.0 canary 1. Now I am working on my existing project on Android Studio 3.0 canary 1. By default gradle:3.0.0-alpha1 is set in my project: gradle_file. So I changed my gradle version to 2.2.3 and now I'm getting this error:

错误:无法完成 Gradle 执行.

Error:Failed to complete Gradle execution.

原因:您使用的 Gradle 版本 (3.3) 不支持BuildActionExecuter 上的 forTasks() 方法.对此的支持是在 Gradle 3.5 和所有更高版本中可用.

Cause: The version of Gradle you are using (3.3) does not support the forTasks() method on BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.

我在这里附上了我的 gradle 文件

I attached my gradle file here

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

推荐答案

我刚刚遇到了同样的问题.通过更改gradle-wrapper.properties"中的 Gradle distributionUrl 来修复它.

I've just had the same issue. Fixed it by changing Gradle distributionUrl in "gradle-wrapper.properties".

这是我的配置:

#Wed Mar 22 16:13:58 BRT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-4.1-all.zip

了解更多详情

帮助迁移的官方视频https://www.youtube.com/watch?v=oBsbI8ICYKg

另见@TmTron下面的评论

see also comment below from @TmTron

这篇关于Gradle 3.3 版不支持 BuildActionExecuter 上的 forTask() 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆