最小支持的 Gradle 版本是6.1.1。当前版本是5.6

在升级到 android Studio 4.0之后,我遇到了这个问题,因为我使用的是旧版本:

(Screen shot attached)

之后我下载了最新的级别版本 6.4.1,完成下载后它给出了错误的

Unable to find method
'org.gradle.api.tasks.TaskInputs.property(Ljava/lang/String;Ljava/lang/Object;)Lorg/gradle/api/tasks/TaskInputs;'.
Possible causes for this unexpected error include:
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)


The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)


Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.


In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.

下面是一幅错误的图片:

Attach image of error

我已经尝试与 无效缓存/重新启动清洁工程 重建项目 也删除了缓存文件夹,但仍然面临同样的问题, 现在我不能用低等级的了。

173273 次浏览

I faced this error. so I added the line below to build.gradle(project) file ,dependency part:

classpath 'com.android.tools.build:gradle:3.6.0'

and I changed distributionUrl in gradle-wrapper.properties file to :

https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

It solved my problem I hope solve yours too.


Update 09/21/2020

Finally, I upgrade all of my plugins and libraries and It works perfectly by gradle-6.6.1-all.zip in gradle-wrapper.properties file and classpath 'com.android.tools.build:gradle:4.0.1' in Gradle project in dependencies section.

Be careful if you use greenDAO or sqlcipher to upgrade correctly

Android studio recommended for gradle upgrade and I got similar error. I quickly found string "5.6.4" using ctrl+shift+f. I got 2 files refering to gradle version 5.6.4 and updated both of them to 6.1.1 and it worked for me.

ALTERNATIVE WAY: Open https://gradle.org/next-steps/?version=6.6.1&format=all to download latest gradle. Now you need to extract it to some location in your PC. Now in android studio press ctrl+alt+s to open settings. Navigate to Gradle and provide path to exttracted folder. Also modify as use gradle from to use specified location(provide extracted path even here). (ViewImage) Click apply and restart android studio.

add this line in gradle-wrapper.properties

distributionUrl=https://services.gradle.org/distributions/gradle-6.1.1-bin.zip it worked for me

Try editing the distributionUrl in ..\android\gradle\wrapper\gradle-wrapper.properties to gradle-6.5-all.zip

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

For me, it seemed that I had upgraded the plugin version to "classpath 'com.android.tools.build:gradle:4.1.2'" but I could not get Android Studio to update to gradle 6.5 from 6.1.1 for some reason.

Eventually I downgraded the plugin to "classpath 'com.android.tools.build:gradle:4.0.0'", according to https://developer.android.com/studio/releases/gradle-plugin.

Then the IDE offered me a quickfix upgrade back to 4.1.2 and also 6.5, and after that it started working again.

For me, this required a multi-stage fix combining several of the above. I had pulled a project that didn't include a gradle directory, so none of the other answers apply.

To create the gradle directory I first edited the build.gradle and downgraded the classpath to match the version from https://developer.android.com/studio/releases/gradle-plugin In the original question, the error shows that the current version is 5.6.4, so that table indicates we should downgrade the build tools to 3.6.0.

classpath 'com.android.tools.build:gradle:3.6.0'

Then I did a sync project with gradle files and built the project. That succeeded since my downloaded gradle matched the requested version. This created the gradle directory, including the gradle-wrapper.properties file.

Then I edited the gradle-wrapper.properties as described in the other replies to update to 6.1.1

distributionUrl = https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

I did another sync project with gradle files and build. Everything worked, so I then updated my build.gradle to restore the original value

classpath 'com.android.tools.build:gradle:4.0.0'

Then I did a third sync project with gradle files and build. Now my project is exactly where it should be with no errors.

I faced this issue just now. And I found the solution.

1) find gradle/wrapper/gradle-wrapper.properties file (not in .gradle folder it is in gradle folder). If your project not have gradle-wrapper.properties file, just create it in that location.

Add these lines to your gradle-wrapper.properties file.

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Remember!

You need to change distributionUrl the current version of gradle version in your Android Studio (in this case it is gradle-5.6.4-all.zip)

Gradle version in either the File > Project Structure > Project menu in Android Studio, or by editing the Gradle distribution reference in the gradle/wrapper/gradle-wrapper.properties file. The following example sets the Gradle version to 6.7.1 in the gradle-wrapper.properties file.

Look for the correct version from below: https://developer.android.com/studio/releases/gradle-plugin

Upgrade Gradle version

Failed to apply plugin [id 'com.android.internal.version-check']
> Minimum supported Gradle version is 6.7.1. Current version is 6.1.1. If using the gradle wrapper, try editing the distributionUrl in G:\Home\androidproject\pactices\appsghor\exoplayer\gradle\wrapper\gradle-wrapper.properties to gradle-6.7.1-all.zip


in wrapper.properties
distributionUrl = https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

For my case, I could not find the Gradle folder from the project which I am trying to syn with gradle, so I copy the whole Gradle folder(You can just create a new Android project and copy from it. for people who could not find gradle-wrapper.properties, it's there.) to the project you have problems with Gradle syn, and it works in my case.

enter image description here

Go to gradle->wrapper->gradle-wrapper.properties then change the version in the distribution url to whatever the error message says is minimum requirement

I also faced this problems many times but I resolved it by changing gradle version from distributionUrl in gradle-wrapper.properties file to https\://services.gradle.org/distributions/gradle-5.6.4-all.zip or Later. Hope that by adding this, error will resolve

Updating the following line in build.gradle helped me:

classpath "de.undercouch:gradle-download-task:5.3.0"

and adding the following line also:

apply plugin: "de.undercouch.download"

As explained in: https://plugins.gradle.org/plugin/de.undercouch.download