Android Gradle command line list examples
This tutorial talks about gradle commands used in android applications.
You can do the same tasks using android studio.
Knowing commands is helpful for mobile developers to get confidence in app build and deployment.
How to list tasks from the command line in the android application
Gradle wrapper provides a task command to list out all available tasks in the Android app.
In windows, Please run the following command
In Linux or Mac or Unix flavors OS machines.
How to build an APK file in an Android project?
Sometimes, We need to generate APK for debugging and testing the app assembleDebug: Following is a command for generating debug APK files with default signed configuration.
Output of the above command generates
It builds and generates a release version of the APK file.
It generates debug and release versions of apk for debugging and release with default signing configuration.
How to install apk files to android devices?
install variants build and generate apk file and install apk to available devices
gradlew installDebug // build & installs debug apk gradlew install // build & installs release apk
How to deploy the android app to the emulator
- First, create android virtual devices.
- Command-line run below command to start the emulator
android_sdk/tools/emulator -avd nameofavd
- Next step is to deploy to the emulator with the ADB command
adb install apkfilepath
apkfilepath is an apk file generated with the
gradle assemble or
gradle install command.
Normally, apk generates in project/module/build/outputs/apk/ folder by default.
How to build an application bundle with Gradle?
Android application bundle contains compiled java code and required resources.
Here is a command to generate bundled code
Sync gradle scripts manually in Android studio
use below command to syn without build
Below gradle version 5.1.1
With recent release
To run build and sync manually