关于“Android Studio and Gradle are using different locations for the JDK.”提示的解决方法

关于“Android Studio and Gradle are using different locations for the JDK.”提示的解决方法
最近在学习Android,发现在Android Studio上出现了几处Event Log,像下面的这种情况
关于“Android Studio and Gradle are using different locations for the JDK.”提示的解决方法
这个提示是说Android Studio和Gradle使用不同位置的JDK。使用不同的JDK位置可能会导致Gradle产生多个守护进程 ,首先 Android Studio 默认下使用的下载时自带的jre,这种jre的功能显然达不到jdk的标准,这会使得开发时可能产生不兼容的问题,当然也可以选择忽略这个警告,但是将来也可能出现问题。因此从长远来看还是解决掉为好。

需要注意的是:
下载Android Studio一定是要下载JDK的,如果原先电脑里下载了JAVA那么也可以使用原有的JDK,Google官方考虑到绝大部分学安卓的人都是学过JAVA的(目前这个IDE适合JAVA和Kotlin语言(PS: Kotlin 是一种在 Java 虚拟机上运行的静态类型编程语言,被称之为 Android 世界的Swift,由 JetBrains 设计开发并开源)),所以应该电脑里提前就下好了JAVA,自然也就有JDK因此不会让Android Studio自带JAVA的JDK了。

解决办法:
1、依次点击File---->Project Strcture
关于“Android Studio and Gradle are using different locations for the JDK.”提示的解决方法
2、将JDK换成Java路径下的JDK。
![在这里插入图片描述](https://img-blog.****img.cn/20200310184308689.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MzYyNDYyNg==,size_16,color_FFFFFF,t_70关于“Android Studio and Gradle are using different locations for the JDK.”提示的解决方法
3、确定设置后,等待一段时间,直到Gradle sync结束(其实也不用等待太长时间),出现下面的界面就是正常结束了,现在问题得到解决。
关于“Android Studio and Gradle are using different locations for the JDK.”提示的解决方法
关于“Android Studio and Gradle are using different locations for the JDK.”提示的解决方法