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

问题描述

我刚刚将我的Android Studio更新为3.0 canary 1.
现在我正在Android Studio 3.0 Canary上开发我的现有项目。
默认情况下 gradle:3.0.0-alpha1 在我的项目中设置:gradle_file。
因此,我将我的gradle版本更改为2.2.3,现在出现此错误:
$ b

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版本(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".

这是我配置的内容:

Here is what I have configured:

#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

获取更多详情

官方视频帮助迁移

另见来自@TmTron的评论

see also comment below from @TmTron

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

08-05 20:52