2

I installed Android Studio on my Mac. I have an android project. I'd like to build it in command-line. If I try to build, or even just get the available tasks:

./gradlew tasks

I got this error:

No Java runtime present, requesting install.

I don't want to install a new JDK. I can build the app in Android Studio. How can I use the JDK installed by Android Studio?

1 Answer 1

6

In this article you can find a solutiuon: https://medium.com/@peter.configcat/build-your-android-app-from-command-line-with-android-studio-on-mac-ee1f7434709b

Add Android Studio JDK to your PATH. Add this to your .zshenv:

export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
export PATH=”$JAVA_HOME/bin:$PATH”

./gradlew tasks and ./gradlew assmebleDebug should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.