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?
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.