Flutter: Build an Android app with Gradle

Gradle is a build system used to build Android apps. Android developers use Android Studio and Gradle to build Android apps. Now with Flutter the future of mobile development, we develop one app (Dart language) and it runs on three platforms(Android, iOS, and Web). We need to learn Flutter and Gradle configuration. Fun fact: as a software engineer you need to learn to use different programming languages, IDE tools, build systems, etc... When building Android apps the thing that changes the most is the UI layer of the app, everyday there is a new library. The build process when building new Android apps does not change often Gradle. In the last 2–3 years, the biggest change I have seen in the Android build process was to publish the App Bundle(.aab) instead of App APK (.apk).

Build Debug APK:

  1. To run Gradle tasks on your Flutter project, using VScode open the terminal and enter the below commands:
cd android

Build a debug app:

./gradlew app:assembleDebug
  1. Gradle build command generates the app file app-debug.apk.
  2. Go to directory /build/app/outputs/apk/debug.
  3. Drag and drop file app-debug.apk to Android device, or use Adb command $adb install app-debug.apk.

Clean Android project:

  1. Deletes all build and output directories and files created.
./gradlew app:clean

All the Gradle tasks in the project enter:

./gradlew tasks — all
./gradlew tasks — all | grep app


Thanks for reading. I started to publish my Flutter notes. Let me know if I’m wrong somewhere. I’m open to your feedback 🙌🏻

  • Andres

software engineer, read, swim, travel. apps: https://goo.gl/rDuuQw https://goo.gl/15GvfE

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store