My XML
layout is not rendering with this error message. I am already using Java 8.
Also using latest build tools in Gradle.
and
Make sure you have installed jdk for x64 and not x84 when starting Android Studio (x64)
Set JDK_HOME
and JAVA_HOME
environment variables, in my case C:\Program Files\Java\jdk1.8.0_60
.
Check Java version in Help > About
. It should show the JRE version you just set.
That is it, now you can preview your layout in N
.
I have solved it in these way.(AS+MAC OX El Capitan)
Go to Help>Edit Custom Properties> A dialog will prompt(press yes) then write
JVMVersion=1.8
Then close Android Studio fully and reload the project
My issue was that the Android N was "partially installed".
My solution was to go to - Preferences/Appearances and Behavior/System Settings/Android SDK and check the Status. If it's "partially installed" then you have to uninstall then reinstall. (Uncheck the checkbox and hit apply; it will uninstall; then you can check the box and install it again) Worked for me. If you go to lower version(like 23) then you have to change the buildToolsVersion variable to "23.0.0" in the build.gradle.
From the docs: https://developer.android.com/studio/intro/studio-config.html#file_location
STUDIO_JDK: set the JDK with which to run Studio
I prefer using the STUDIO_JDK variable and leave other default java home variables alone.
I had faced the same problem. Please make sure that you are rendering the XML layout for the compiled SDK version (Must not be greater) . Means you will face this if you are compiling the code using Targeted SDK version 23 and your trying to render the XML in SDK version 24.