Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I got the same error you describe but on OS X. I know this may not solve your problem (because I don't know the equivalent for Windows), but since this is not OS specific I am leaving the solution for any OS X fellow out there. Edit the file /Applications/Android Studio.app/Contents/Info.plist, and remove the 1.6 version (in my case), you may place 1.6+, 1.7+ or 1.8, whichever you prefer. Mine ended up like this

...
<key>JVMVersion</key>
<string>1.7+</string>
...

Be aware there's an incompatibility with drag and drop with java versions 1.8_60 to 1.8_75 (IDEA-146691) which the IDE will report once you successfully change the version.

For non Terminal Users

  1. Find your Android Studio.app file. If it's in the dock you can right click it and choose Options > Show in Finder.
  2. Right click it and choose Show package content.
  3. Navigate to the mentioned file (Contents/Info.plist).
  4. Edit the file with your favorite text editor.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...