One demon for all
(☝It is intentional misspelling from daemon
)
You probably read a great article from Svyatoslav Chatchenko about how to use the same daemon from Android Studio and console.
However, if you started using Android Studio 3.5, after some mixed runs of the project from Android Studio and from the console, you might see the following log if you run ./gradlew — status
:

Congratulations, you still don’t share them. The problem is again the JDK location.
The fix!
If you downloaded and installed JDK upfront and specified JAVA_HOME
environment variable:
- Find yours
JAVA_HOME
destination by runningecho $JAVA_HOME
- Copy printed destination
- Open project structure:

- And put destination to JDK location:

If you always used embedded JDK from Android Studio:
- Open project structure

- Select, if needed, and copy embedded JDK location

- Define
JAVA_HOME
environment variable and point it to embedded JDK (Google it for your operating system)