'Error with ktlintGradle - The WorkerExecutor.submit() method has been deprecated

I can run project on my emulator/phone, but when I do ./gradlew check command, I got the following error:

The WorkerExecutor.submit() method has been deprecated. This is scheduled to be removed in Gradle 8.0. Please use the noIsolation(), classLoaderIsolation() or processIsolation() method instead. See https://docs.gradle.org/7.2/userguide/upgrading_version_5.html#method_workerexecutor_submit_is_deprecated for more details.

I tried to find for WorkerExecutor in the code and could not. The only hint that I got was that it might be used in Dagger. I tried updating Dagger to the latest version but it did not work. Any ideas?

    androidGradlePlugin    : 'com.android.tools.build:gradle:7.1.3',
    ktlintGradle           : 'org.jlleitschuh.gradle:ktlint-gradle:10.0.0',
    distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source