Android Nougat requires the IDE to be running with Java 1.8 or later [duplicate]

耗尽温柔 提交于 2020-01-21 02:34:45

问题


Inspite of having JDK 8 installed, I'm getting this error. What can the issue be?


回答1:


  1. Check installed java version, it should be 1.8 or later.

MBP-Vitaliy:~$ java -version
java version "1.8.0_92"
Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)
  1. Check java version in Android Studio. In Mac OS X: Android Studio -> About Android Studio. Where JRE should be 1.8 or later.

  2. If you have another, In Mac OS X go to Applications folder find AndroidStudio.app and click Show content, then find in Content folder Info.plist file and change JVM VERSION to 1.8 manually.

<key>JVMVersion</key>
<string>1.8</string>
  1. Restart Android Studio.



回答2:


for mac users @Vitaliy Movchan answer works.

for windows users (who has to set JAVA_HOME in their operative system):

  • Install the JDK 1.8 and note the destination path, usually C:\Program Files\Java\jdk1.8.0_xx
  • Right-click My Computer and select Properties.
  • Click the Advanced System Settings link in the left column.
  • In the tab Advanced click Environment Variables
  • Create or modify the variable JAVA_HOME.
  • Enter the variable value as the installation path for the Java Development Kit.



回答3:


You can still get the layout rendered during design time in the IDE if you choose Android version 23 (Marshmallow) rather than version 24 (Nougat).

This isn't a long-term solution, but for most purposes it should be good enough. You can always see the actual Nougat layout by running your app in the Android emulator.




回答4:


Add JVMVersion 1.8*, 1.8+ to info.plist of android studio app and also check for default java version




回答5:


I had the same problem, in my system i have installed 3 jdks. jdk1.6, jkd1.7, and jdk1.8. I am working on some projects which requires jdk 1.7 so i can't change JAVA_HOME.

So i have found another solution by tell android studio which JAVA_HOME needs to be used.

So i just edit studio.sh file and added JAVA_HOME variable.

JAVA_HOME = /usr/lib/jvm/java-8-oracle/

studio.sh file

After Restart android-studio started pointing to jdk 1.8. Hope this will help.



来源:https://stackoverflow.com/questions/39240533/android-nougat-requires-the-ide-to-be-running-with-java-1-8-or-later

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!