由于“Gradle Doctor Prescriptions”,无法同步或生成项目|未设置JAVA_HOME”和“未能通知项目评估侦听器”

wtzytmuj  于 2023-05-18  发布在  Java
关注(0)|答案(1)|浏览(268)

我无法同步或构建Android项目,因为有两个错误:
1.首先,我得到了:

> =============================== Gradle Doctor Prescriptions ============================================
  | JAVA_HOME is not set.                                                                                |
  | Please set JAVA_HOME so that switching between Android Studio and the terminal does not trigger a fu |
  | ll rebuild.                                                                                          |
  | To set JAVA_HOME: (using bash)                                                                       |
  | echo "export JAVA_HOME=$(/usr/libexec/java_home)" >> ~/.bash_profile                                 |
  | or `~/.zshrc` if using zsh.                                                                          |
  ========================================================================================================

1.然后Clean Project之后

/Library/Internet
* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring root project
Caused by: org.gradle.internal.event.ListenerNotificationException: Failed to notify project evaluation listener.
Caused by: java.nio.file.NoSuchFileException: /Library/Internet
    at com.osacky.doctor.JavaHomeCheck.isGradleUsingJavaHome(JavaHomeCheck.kt:68)
    at com.osacky.doctor.JavaHomeCheck.onStart(JavaHomeCheck.kt:41)
    at com.osacky.doctor.DoctorPlugin$apply$1.execute(DoctorPlugin.kt:61)
    at com.osacky.doctor.DoctorPlugin$apply$1.execute(DoctorPlugin.kt:29)

我很确定JAVA_HOME设置正确Gradle版本与此处描述的插件版本兼容。我清理了项目,使“无效并重新启动”,甚至删除和添加了项目。
任何帮助都很感激。

8dtrkrch

8dtrkrch1#

我终于找到了解决办法:为了摆脱错误,我需要禁用build.gradle.kts中的一个插件(项目级别)
我通过从plugins中删除id("com.osacky.doctor") version "0.7.0"来解决它

相关问题