My XML
layout is not rendering with this error message. I am already using Java 8.
Also using latest build tools in Gradle.
and
I met the same issue.
I installed jdk1.6,jdk1.7,jdk1.8, and deployed Studio as what you did.
My solution is uninstall jdk1.6 and jdk1.7, only leave jdk1.8
sudo rm -rf ${path to jdk1.6}
sudo rm -rf ${path to jdk1.7}
That's all.
I'm using Ubuntu 14.04 and I was facing a similar error, with the difference I don't have NDK. My solution was, after setting up Java 8 in project definition, reboot Android Studio, no more.
Check system Java version, in console "java -version", output should say something like this
java version "1.8.0_91"
Had the same problem with Ubunutu. The problem was not running the IDE with Java8.
I fixed it with updating the default java program of the OS, using:
sudo update-alternatives --config java
And choosing the relevant Java8 path.
For Mac users with this issue (I'm running OS X 10.11.5 and Android Studio 2.1.2), here's how you can solve it:
Currently, the Mac version of Android Studio is run with Java 6 (not necessarily the same as the JDK version for the app), because Java 6 has better font rendering than Java 7 & 8, and that's apparently more important than rendering your layout.
First of all, make sure you have JDK 8 installed.
Then run the following commands:
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk
$ open /Applications/Android\ Studio.app/
You may need to change the 91
in jdk1.8.0_91.jdk
to a different version. You can see which JDK versions you have with:
$ ls /Library/Java/JavaVirtualMachines/
Unfortunately, this method requires opening the app from the terminal, but you could always create a script for it.
More info
Edit: And if you really don't want to open it from the terminal:
do shell script "export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk; open /Applications/Android\\ Studio.app/"
Click on the letter N, next to the android icon in the Preview window and select API level 23 or lower. That should solve it.