Either
./gradlew
, or gradlew.bat
if on Windows
chmod +x ./gradlew
may be necessaryFrom this point onwards, gradle
refers to running Gradle whichever way you've chosen.
Substitute accordingly.
If you've manually installed the SDK
export ANDROID_HOME=<install location>
~/.profile
if it's not done automaticallyAccept the licenses: yes | sdkmanager --licenses
sdkmanager
can be found in $ANDROID_HOME/tools/bin
sdkmanager
may have to be run as rootTry running gradle
chown -R user:group $ANDROID_HOME
chmod 777 -R $ANDROID_HOME
gradle tasks
lists all tasks that can be run:app:[appname]
is the prefix of all tasks, which you'll see in the Gradle
logs when you're building
Some essential tasks
gradle assemble
: build all variants of your app
app/[appname]/build/outputs/apk/[debug/release]
gradle assembleDebug
or assembleRelease
: build just the debug or release versionsgradle installDebug
or installRelease
build and install to an attached device
adb devices
, check that your device is listed and device is
beside itAutomatically build and install upon changes
This avoids having to continuously run the same commands
gradle -t --continue installDebug
-t
: aka --continuous
, automatically re-runs the task after a file is changed--continue
: Continue after errors. Prevents stopping when errors occurgradle -h
for more help