There are two possible cases where Error:java: Compilation failed: internal java compiler error occurs.
1. May be the jdk version is inconsistent
Check the following three points respectively to see if they are consistent.
- The version in Preferences -> Compiler -> Java compiler sets the SDK version
- SDK version in File -> Project Structure -> Project
- File -> Project Structure -> Module -> Module SDK version in each module Dependencies
2. The memory setting of the compilation environment may be insufficient.
Preferences -> Compiler -> Shared build process heap size
Increase the default