Gradle version 3.3 does not support forTask() method on BuildActionExecuter
Change in the file "gradle-wrapper.properties".
Put this line and Sync Project-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
This will work. For Check latest version services.gradle.org/distributions
After changed, Sync Project, Clean and Rebuild project once from Build menu.
This happened when trying to build debug apk.
SOLUTION: Update Gradle version to 3.5
Navigate to File -> Project Structure -> Project -> Gradle Version = 3.5
This works for Android Studio 3.0
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
for more details
Offical video to help migaration https://www.youtube.com/watch?v=oBsbI8ICYKg
see also comment below from @TmTron