Hello! I have a question related to JDK. In docs t...
# multiplatform
d
Hello! I have a question related to JDK. In docs there is a statement that android studio is embedded with JDK for gradle tasks. What is the purpose to install JDK on mac if android studio already have JDK to build the project? Thanks
v
The biggest benefit is that it would allow you to run things outside the IDE. Mainly on the terminal, for example. If you open the terminal and do something like
./gradlew build
, it won't be able to do execute. Only if you specify the path to the JDK via an argument, or set the JDK in your
JAVA_HOME
environment variable. If that's the case (if you want to run on the terminal), or maybe on multiple IDEs. Using the same JDK between them would bring you more consistency. I know developers that had, for example, JDK 11 on their IDEs and JDK 8 or 17 on their machines. And "running from the terminal isn't working" or "running from the IDE isn't working", because some plugins or even Gradle itself wasn't compatible with one of the JDKs. I'm not sure about Gradle caches, but I wouldn't be surprised if some part of it is invalidated when it runs using a different JDK. Which could slow things down when switching between one JDK and another.
d
Thank you very much for the explanation
Now it’s clear