New project error
提示:新建项目报错
Failed to apply plugin 'com.android.internal.application':
Problem Description
When I create a new project and the gradle version is 7.0, I get an error when I run the project.
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
Cause Analysis:
Tip: The gradle version may be too high. You need to use the Java11 that comes with Android studio to run it.
solution:
1.Select tool: project structure
2. Click gradle setting
3.Select Gradle JDK
4. Use the 11 version that comes with Android Studio
Then run the project, solved!