Search code examples
androidandroid-studioandroid-7.0-nougat

Android N requires the IDE to be running with Java 1.8 or later?


My XML layout is not rendering with this error message. I am already using Java 8.

enter image description here

Also using latest build tools in Gradle.

android {
    compileSdkVersion 'android-N'
    buildToolsVersion 24.0.0 rc1
    ...
}

XML Error -

enter image description here


Solution

  • Set JDK_HOME and JAVA_HOME environment variables, in my case C:\Program Files\Java\jdk1.8.0_60.

    enter image description here

    Check Java version in Help > About. It should show the JRE version you just set.

    enter image description here

    That is it, now you can preview your layout in N.