Issue
I want to build an Android Studio app (the Gradle build system), but I want to do this via the command line.
Solution
Android Studio automatically creates a href="http://www.gradle.org/docs/current/userguide/gradle_wrapper.html" rel="noreferrer">Gradle wrapper in the root of your project, which is how it invokes Gradle. The wrapper is basically a script that calls through to the actual Gradle binary and allows you to keep Gradle up to date, which makes using version control easier. To run a Gradle command, you can simply use the gradlew
script found in the root of your project (or gradlew.bat
on Windows) followed by the name of the task you want to run. For instance, to build a debug version of your Android application, you can run ./gradlew assembleDebug
from the root of your repository. In a default project setup, the resulting apk can then be found in app/build/outputs/apk/app-debug.apk
. On a *nix machine, you can also just run find . -name '*.apk'
to find it, if it's not there.
Answered By - FuegoFro
Answer Checked By - David Marino (JavaFixing Volunteer)