This error message typically indicates that there is an incompatible version of the Gradle daemon running on your system. To solve this issue, you can try the following steps:
Quick fixes
Before continuing, make a backup copy of your Unity project.
Clear the Library folder
- Stop Unity
- Delete your Library folder (e.g. D:\YOUR_UNITY_PROJECT\Library)
Clear out the .gradle Folder
- Delete the .gradle folder in your home folder (C:\Users\<USERNAME>)
- Restart your computer
- Restart Unity and rebuild your project
Other Causes of this Error
You have upgraded between major Unity Version (e.g. from 2021.X to 2022.X)
First, make sure to also update any 3rd party libraries or packages to the newest version. Outdated packages may cause the gradle build to fail with this misleading error message.
When building a Unity project using Gradle, it’s important to ensure that all third-party libraries or packages are up-to-date. This is because outdated libraries or packages may contain bugs or compatibility issues that can cause the Gradle build to fail. In some cases, these issues can result in misleading error messages that may be difficult to troubleshoot.
If an update is available, it’s important to carefully review the release notes and changelog for the library or package to understand any potential breaking changes or compatibility issues that may affect your project. Once you’ve determined that an update is safe to apply, you can update the library or package in your project by updating the relevant dependencies in your build.gradle file.
By keeping your third-party libraries and packages up-to-date, you can help ensure that your Gradle builds are reliable and free from misleading error messages.