每次更新到1.8路径时,Android Studio JDK位置都会更改回1.7 [英] Android Studio JDK location changes back to 1.7 every time it is updated to 1.8 path
问题描述
我最近安装了jdk 1.8 u92,之后Android Studio表示api24版本需要它。但是,我现在遇到了这个问题。
我查看了其他一些解决方案并卸载了jdk 1.7,为JDK_HOME,JAVA_HOME和JAVA8_HOME添加了环境变量。问题仍然存在。
每当我尝试构建应用程序时,gradle同步失败,Android工作室要求我选择有效的JDK目录 。然后我转到项目结构=> JDK位置并将其更新到1.8文件夹。尝试再次构建会产生相同的错误,当我检查项目结构时,路径将自动重新设置为旧的JDK 1.7。
是否有针对此问题的修复?
查看Android工作室设置目录中的几个文件后想出来。
如果您一直在升级Android Studio并从以前的安装中导入设置,可能会发生这种情况(全新安装也可能会发生这种情况)。
<解决方案:
- 转到Android Studio配置文件夹所在的位置(通常位于$ HOME / .AndroidStudio2.1 / confg)。
- 打开选项文件夹并删除文件 jdk.table.xml (保留备份以防万一)
- 重启Android Studio
这解决了我的问题。新创建的jdk.table.xml将具有更新的java8值(最有可能从JDK_HOME环境变量中获取)。
I recently installed jdk 1.8 u92 after Android Studio said it is needed for api24 builds. However, I've run into this issue now.
I looked at some other solutions and uninstalled jdk 1.7, added environment variables for JDK_HOME, JAVA_HOME, and JAVA8_HOME. The problem still persists.
Every time I try to build the app, gradle sync fails and Android studio asks me to Choose a valid JDK directory. I then go to Project Structure => JDK Location and update it to the 1.8 folder. Trying to build again gives the same error and when I check the Project Structure, the path is set back to the old JDK 1.7 automatically.
Is there any fix for this issue?
Figured it out after looking at a few files inside the Android studio settings directory.
If you've been upgrading your Android Studio and importing settings from previous installations, this might happen (it might also happen with a fresh installation).
Solution:
- Go to wherever your Android Studio config folder is located (usually at $HOME/.AndroidStudio2.1/confg).
- Open the Options folder and delete the file jdk.table.xml (keep a backup just in case)
- Restart Android Studio
This fixed the issue for me. The newly created jdk.table.xml will have updated java8 values (which it most probably fetches from the JDK_HOME environment variable).
这篇关于每次更新到1.8路径时,Android Studio JDK位置都会更改回1.7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!