How to fix “Android N requires the IDE to be running with Java 1.8 or later” on Mac?


I get this error while I was in layout editor selecting api N for preview, It was so easy to fix,

  1. install jdk1.8
  2. Set “JDK_HOME” and “JAVA_HOME” environment variables.
  3. Edit the file “/Applications/Android"
  4. Look for “JVMVersion”
  5. add “1.8*,1.8+” to it:

Now restart your “Android Studio”