Could not create service of type ChecksumService using BuildSessionScopeServices.createChecksumService()

Viewed 2382

I am new in gradle and when I try to simple check gradle built in tasks, I get Build Failed error.

Can anybody explain what is wrong?

I only run 'gradle tasks' on cmd and get next error:

    FAILURE: Build failed with an exception.

* What went wrong:
Gradle could not start your build.
> Could not create service of type ChecksumService using BuildSessionScopeServices.createChecksumService().
   > Timeout waiting to lock checksums cache (M:\.gradle\checksums). It is currently in use by another Gradle instance.
     Owner PID: unknown
     Our PID: 14372
     Owner Operation: unknown
     Our operation:
     Lock file: M:\.gradle\checksums\checksums.lock

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with
--scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 1s
5 Answers

This was a permissions issue for me. I tried running a project on my Mac from my mounted Google Drive directory and got this error.

Moving the project to Documents worked.

./gradlew --stop as the error happens when gradle didn't close cleanly. Such as in: Cannot lock checksums cache (/Users/.../StudioProjects/android/.gradle/7.4.2/checksums) as it has already been locked by this process.

FWIW, I forgot to stop the server in IntelliJ and once I did the problem went away.

For Flutter users

I faced this problem on Mac OS Monterey (M1 processor)

I solved it in the following way

  1. Browse android/buil.gradle add or update gradle version to 7.1.2
    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'. //---this
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
  1. Update distributionUrl in android/gradle/wrapper/gradle-wrapper.properties to 7.4
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
  1. Navigate in the terminal to the android folder and run
cd android

despues

./gradlew --stop

4.Run flutter clean and flutter pub get

flutter clean
flutter pub get
  1. Then run flutter run
flutter run

Just restart your machine. it's a cache related error

Related