Using different JDK locations on different processes might cause Gradle to spawn multiple daemon

错误描述

1
2
3
4
5
Android Studio is using the following JDK location when running Gradle:
    /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
    Using different JDK locations on different processes might cause Gradle to
    spawn multiple daemons, for example, by executing Gradle tasks from a terminal
    while using Android Studio.

原因:

Mac上有jdk1.8 和 Android sdk,然后在as中没有找到你的jdk,使用了Android sdk,而你的程序中gradle需要使用jdk,因此需要明确指定下。

解决方法:

点击下拉选项,选择java的jdk即可!

参考资料:

https://stackoverflow.com/questions/56192983/android-studio-is-using-this-jdk-location-which-is-different-to-what-gradle

https://blog.csdn.net/qq_42315540/article/details/103793582