Do I need a Java JDK to use Android Studio?

I am studying Android Studio and tutorials on YouTube:

https://www.youtube.com/watch?v=QAbQgLGKd3Y&list=PL6gx4Cwl9DGBsvRxJJOzG4r4k_zLKrnxl

Say I need a Java JDK.

However, when I looked at the tutorial on the website:

https://developer.android.com/training/basics/firstapp/creating-project.html

I was able to configure and run myfirstapp project.

Are new ASs included in the SDK or will I need this for more complex projects.
I guess I can just start the video tutorial until I run into a problem, but I would like to know before I uninstall Android Studio, install the JDK and reinstall Android Studio.

It seems like a real pain.

+20
source share
4 answers

Android Studio version 2.2 and higher comes with the latest built-in OpenJDK to provide low access for beginners.

However, it is recommended that you install the JDK yourself, as you can update it independently of Android Studio.


If you are working with the Android API <24, then you need to compile the project with Java 7 or take a few additional steps to enable Java 8 features . (Note: Java 8 support is relatively new).

Android Studio 3.0 and later support all Java 7 language features and a subset of Java 8 language features

+30
source

This is what Google says about https://developer.android.com/studio/intro/studio-config.html :

A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the version of the JDK that we recommend using for your Android projects.

So, if you are using the latest version , you won’t need an additional JDK . In addition, the official installation instructions no longer contain any allusions to the JDK compared to June 2016 .

+51
source

Previously, you needed to install the JDK; hence the video telling how to do it. Recent versions include a built-in JDK. Please note that Android Studio has evolved rapidly, and tutorials are quickly becoming obsolete.

Please note that installing Android Studio does not automatically configure the built-in JDK command-line tools. This is important if you want to use the Android SDK command line tools. To fix this, find the bin directory in the Android Studio installation, which contains the java command (a native command that actually runs the Java virtual machine), and add it to your path. (Another thing that may change, so I will not add specific directories to this answer.) This file is java.exe on Windows; on any other platform, it is called java and has permission to execute.

(You also need to add directories containing the SDK tools themselves.)

There are actually two such directories because the JDK, like all Java applications, contains the Java Runtime Environment (JRE). If you just want to run the SDK tools, it doesn't matter which bin directory you choose. But if you want to compile and run Java code outside of Android Studio, then you need to use the bin containing the javac command, among other important JDK development tools.

Or you can simply install the latest JDK. There is no real reason not to do this.

+2
source

On a Mac, the path for the Java Studio Android environment can be set using this export command:

export JAVA_HOME = / Applications /Android\Studio.app/Contents/jre/jdk/Contents/Home/

This uses JAVA (OpenJDK), which comes with Android Studio.

+1
source

Source: https://habr.com/ru/post/1264094/


All Articles