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

后端 未结 17 1369
无人共我
无人共我 2020-11-27 10:58

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

Also using latest build tools in Gradle.

and         


        
相关标签:
17条回答
  • 2020-11-27 11:42

    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.
    0 讨论(0)
  • 2020-11-27 11:44

    I was facing the same problem recently. Try changing the API preview level to 23 or lower. That worked for me.

    0 讨论(0)
  • 2020-11-27 11:44

    try to use in project Java 1.8 - download last version of JDK and install it(if JSK is absent)

    Then add to build.gradle these lines android { ... // Configure only for each module that uses Java 8 // language features (either in its source code or // through dependencies). compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } // For Kotlin projects kotlinOptions { jvmTarget = "1.8" } }

    0 讨论(0)
  • 2020-11-27 11:46

    There are several thing to remember when set the STUDIO_JDK on Mac OS:

    • by default Apple's Java 1.6 is used to start the Android Studio
    • when the STUDIO_JDK is set to Oracle's Java it will be used by the Android Studio to run

    The difference between two is that Apple's Java IMO provides nicer and better fonts antialiasing in the IDE.

    A reply here is referencing a bug in Android Studio regarding the fonts antialiasing. The ticket is already closed but still rendering is different for Apple Java and Oracle SDK (I have v1.8.0_102). And the former still has better perception than the last.

    0 讨论(0)
  • 2020-11-27 11:50

    machine: windows8 64bit in my case the jdk1.7 I had installed was 32bit hence I was using studio.exe (32bit) so even when I downloaded the new jdk1.8 (64bit) the studio instance I was using (32bit) couldn't detect it, but when I uninstalled the older jdk and tried to rerun studio.exe I was told to install a 32bit jdk. so I ran studio64.exe and it ran smoothly. ensure you have the correct path in your environment variables. cheers android N

    0 讨论(0)
  • 2020-11-27 11:53

    I faced the problem "Android N requires the IDE to be running with Java 1.8 or later." The error kept showing up in spite of setting C:\Program Files\Java\jdk1.8.0_92 as the project's JDK in File > Project Structure.

    I solved it by updating JAVA_HOME in my environment variables from C:\Program Files\Java\jdk1.7.0_67 to C:\Program Files\Java\jdk1.8.0_92. When I did that and restarted Android Studio, the design mode became available.

    OS: Windows 10

    Android Studio: 2.1.2

    0 讨论(0)
提交回复
热议问题