Android Studio 2.2. Preview 1 error: “Please use JDK 8 or newer”

后端 未结 6 710
别跟我提以往
别跟我提以往 2020-12-16 18:54

On trying to run Android Studio 2.2 Preview 1, it gives the following error on gradle build:

Error:Please use JDK 8 or newer.

If

相关标签:
6条回答
  • 2020-12-16 19:28

    if you are using 3.0.1 first enable the use embedded jdk option from File-> project structure -> enable use embedded jdk

    0 讨论(0)
  • 2020-12-16 19:29

    This worked out perfectly when I had an issue with gradle:

    1. First verify that your JDK is indeed higher than JDK 8 jdk version .
    2. Press Ctrl+Alt+Shift+S to open project structure .
    3. Then I selected Use the embedded JDK .
    4. Click OK and retry it.
    0 讨论(0)
  • 2020-12-16 19:39

    I ran into this issue with a previous version of Android Studio. When I first installed Android Studio I was able to reference JDK 7 in my Program Files directory.

    When I upgraded Android Studio and tried to update it to point to JDK 8, which was also in my Program Files directory, I got the same behavior you are seeing. The new path never took and it still used JDK 7.

    Turns out Android Studio does not like spaces in the paths to the Android SDK and the JDK. Installing the JDK in a location that does not contain any spaces allowed me to update the location through the Project Structure window.

    0 讨论(0)
  • 2020-12-16 19:40

    If you use Android Studio 2.2 Preview 2 and have same error just check "Use embedded JDK" in SDK Location.

    0 讨论(0)
  • 2020-12-16 19:43

    Yes, I strongly agree with Episodex. but still, the problem would occur please do as described below, Click on File menu at the top of the left corner and a select menu of Invalidate caches/Restart...

    0 讨论(0)
  • 2020-12-16 19:48

    Use File -> Project Structure to set the SDK and JDK. I think you are modifying a generated file.

    Also try adding this in your gradle file:

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    
    0 讨论(0)
提交回复
热议问题