Reputation: 305
I am getting this error while opening a project
Cause: dagger/hilt/android/plugin/HiltGradlePlugin has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
What i tried are :
Plugin [id: 'dagger.hilt.android.plugin'] was not found in any of the following sources
https://github.com/google/dagger/issues/3495
Dagger-hilt error while compiling project
Class has been compiled by a more recent version of the Java Environment
java.lang.unsupportedclassversionerror in gradle build
Upvotes: 13
Views: 11134
Reputation: 402
The YouTube link solution reported fixed the issue in my case, however here the instructions for the very latest Android Studio version (Android Studio Dolphin | 2021.3.1 Patch 1) on MacOS
If this doesn't work could be something deeper messed up in your machine JDK configuration or IDE configuration, would be easier I think to uninstall completely the IDE, clean the configuration file and install from scratch. It could be overkill but sometime this is the most reliable way especially when nothing works.
Upvotes: 22
Reputation: 131
If none of the above worked for you. Try this:
Click on File -> Project Structure -> SDK Location -> JDK Location
Select the right JDK location and sync.
Note: If you are using latest Android Studio you might not see the last part JDK Location but JDK Location was moved to Gradle Settings instead, click on it and change your JDK location.
Upvotes: 0
Reputation: 368
In Android studio (Electric Eel), doing the following might resolve this issue:
File -> Settings -> Build, Execution & Development -> Build Tools -> Gradle and change the Gradle JDK to 11
Upvotes: 16