如何将 Java 9 添加到 Android Studio? [英] How to add Java 9 to Android Studio?
问题描述
我使用的是 Robolectric 库,它的最新版本 v4.3.1 需要 Java 9 才能运行.我试图将 JRE 指向编辑配置,但即使我已经安装了它,我也没有在下拉列表中找到 Java 9.如果有人可以解释一下,那将非常有帮助!
I am using Robolectric library and the latest version of it v4.3.1 requires Java 9 to run. I am trying to point JRE on edit configurations but I am not finding Java 9 in the drop-down even though I have already installed it. It would be really helpful if somebody can please explain!
请检查是否安装了 Java 9.
Please check Java 9 installed.
推荐答案
在 Android Studio 中运行 Robolectric 测试的唯一解决方法是更改测试任务的 JRE.
The only workaround to run Robolectric test in the Android Studio is to change JRE for the test task.
选择IDE菜单Run->Edit Configuration,然后将图片中的选项改为JDK9的位置:
Select IDE menu Run -> Edit Configuration and then change the option from the picture to the location of JDK9:
这篇关于如何将 Java 9 添加到 Android Studio?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!