The exception message indicates that the Android Gradle plugin requires Java 11 to run, but you are currently using Java 1.8. To resolve this issue, you can try one of the following options:
\

  1. Changing IDE settings:\
    • Open your IDE (e.g., Android Studio).\
    • Go to "File" > "Project Structure".\
    • Under "Project SDK", select Java 11 or higher. \
    • Apply the changes and sync your project.
      \
  2. Changing the JAVA_HOME environment variable:\
    • Set the JAVA_HOME environment variable to point to your Java 11 installation directory. \
    • Update the PATH environment variable to include the bin directory of Java 11. \
    • Restart your IDE and try building the project again.
      \
  3. Changing org.gradle.java.home in gradle.properties:\
    • Open the gradle.properties file in your project's root directory. \
    • Add the following line and replace /path/to/java11 with the actual path to your Java 11 installation directory:
      org.gradle.java.home=/path/to/java11\
    • Save the file and try building the project again.

      Make sure to use Java 11 or a higher version compatible with the Android Gradle plugin.

原文地址: https://www.cveoy.top/t/topic/pOyL 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录