Reputation: 129
I already tried to Invalidate/Cache and restart
also tried to remove .gradle and gradle file.. but this problem still shows up.
Error:Unable to find method 'com.android.build.gradle.BaseExtension.getTestVariants()Lorg/gradle/api/internal/DefaultDomainObjectSet;'. Possible causes for this unexpected error include:
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
- 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.
Any thoughts?
Your help will be appreciated Thanks!
Upvotes: 11
Views: 22513
Reputation: 1
in the gradle-wrapper.properties I changed the "https" to http and everything worked perfect
distributionBase=GRADLE_USER_HOME
distributionUrl=http\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
Upvotes: 0
Reputation: 40810
Tried to manually download the gradle, and clear gradle distributions in C:\Users\myUserName\.gradle\wrapper\dists
.. Nothing worked.
The only thing worked for me is to install java JDK 11, then set it in
File > Project Structure -> SDK location -> JDK location
And then redownload the gradle distribution;
I am using Android Studio v4.2, so it may differ for lower versions.
Upvotes: 0
Reputation: 316
I have the same error. I solved this error by change version of gradle distribution in gradle-wrapper.properties (you can find list of distribution in https://services.gradle.org/distributions/)
gradle-wrapper.properties
For the example my old version gradle distribution:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
My new version gradle distribution:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
By changed this version, android studio will download the new of gradle disrtribution and sync with the project. This is the location of gradle-wrapper.properties
Upvotes: 2
Reputation: 11
I think your version of kotlin-gradle-plugin is low; you can try to update your kotlin-gradle-plugin in project/build.gradle
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.2-4'}
Upvotes: 1
Reputation: 2601
You need to Change the distributionUrl
in gradle-wrapper.properties
in gradle scripts
. And this error can be solved.
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
Upvotes: 0
Reputation: 535
Delete /.gradle/ folder and /gradle/ folder and reimport. Or in the case of IntelliJ, you can click the Gradle Tool window and click Refresh.
Upvotes: 0
Reputation: 41
I had a similar problem, with the following symptoms:
.gradle
folder from project - it doesn't work.gradle-3.3
, so it confused me a long time.I noticed the tips unzip exception:
java.util.zip.ZipException: error in opening zip file
I tried to unzip the file by hand, it said it couldn't unzip, so the problem must have happened in the download process.
My solution:
I copied the file gradle-3.3-all.zip
from my colleague who managed to build successfuly,and replaced mine in this path:
.gradle/wrapper/dists/gradle-3.3-all/55gk2rcmfc6p2dg9u9ohc3hw9/gradle-3.3-all.zip
Upvotes: -1
Reputation: 11
Try to reset the gradle to an older version which you can load correctly. Change the distributionUrl in gradle-wrapper.properties in gradle scripts. And this error can be solved.
Upvotes: 1