How to specify the JDK version in android studio?

前端 未结 5 1005
青春惊慌失措
青春惊慌失措 2020-11-28 06:48

Android Studio is giving me a Gradle build error that looks like this:

Error:(3, 22) compileSdkVersion android-22 requires compiling with JDK 7
相关标签:
5条回答
  • 2020-11-28 07:19

    On a Mac, you can use terminal to go to /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home (or wherever your Android SDK is installed) and enter the following in the command prompt:

    ./java -version
    
    0 讨论(0)
  • 2020-11-28 07:29

    For new Android Studio versions, go to C:\Program Files\Android\Android Studio\jre\bin(or to location of Android Studio installed files) and open command window at this location and type in following command in command prompt:-

    java -version

    0 讨论(0)
  • 2020-11-28 07:30

    In Android Studio 4.0.1, Help -> About shows the details of the Java version used by the studio, in my case:

    Android Studio 4.0.1
    Build #AI-193.6911.18.40.6626763, built on June 25, 2020
    Runtime version: 1.8.0_242-release-1644-b01 amd64
    VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
    Windows 10 10.0
    GC: ParNew, ConcurrentMarkSweep
    Memory: 1237M
    Cores: 8
    Registry: ide.new.welcome.screen.force=true
    Non-Bundled Plugins: com.google.services.firebase
    
    0 讨论(0)
  • 2020-11-28 07:31

    This is old question but still my answer may help someone

    For checking Java version in android studio version , simply open Terminal of Android Studio and type

    java -version 
    

    This will display java version installed in android studio

    0 讨论(0)
  • 2020-11-28 07:33

    You can use cmd + ; for Mac or Ctrl + Alt + Shift + S for Windows/Linux to pull up the Project Structure dialog. In there, you can set the JDK location as well as the Android SDK location.

    Project Structure Dialog

    To get your JDK location, run /usr/libexec/java_home -v 1.7 in terminal. Send 1.7 for Java 7 or 1.8 for Java 8.

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