I want to run the command gradle detekt
on Android Studio’s terminal but I always get the error:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.version-check'.
> Minimum supported Gradle version is 8.7. Current version is 8.2. If using the gradle wrapper, try editing the distributionUrl in C:Users...gradlewrappergradle-wrapper.properties to gradle-8.7-all.zip
But my gradle-wrapper.properties
is the following:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.7-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
It is already set on gradle-8.7-all.zip
I also have invalidated cache and restarted.
On project structure I have this
Why AS is still saying that my version is 8.2 when I run the command?
2
Answers
When you run
gradle
you are running the Gradle version installed globally on your system.To use the locally installed wrapper, you need to run the file
gradlew
instead (orgradlew.bat
on Windows), located in your project root directory1.1 Documentation
I just had this problem and invalidating cache fixed the issue.
File > Invalidate Caches…
enter image description here