It seems you’re using Java 1.8 to compile but in your android studio project you may have set the java language level to 14.
In Android Studio, go to Project Structure -> Modules -> Properties and
set Source Compatibility and Target Compatibility to
1.8 (Java 8)
CLICK HERE to find out more related problems solutions.