Beginner’s Guide to Gradle and What “Building an Application” Really Means

If you've ever looked at a project and seen commands like ./gradlew installDist
and wondered what the heck is going on here? — you're not alone. As a beginner, the concept of "building" an application can feel abstract. Let’s simplify that and understand it step by step.
🚀 What is Gradle?
Gradle is a build automation tool — think of it as your project’s personal assistant. Its job is to:
Compile your code
Download necessary dependencies
Package your app
Run tests
And even deploy it, if needed
It’s widely used in Java, Android, Kotlin, and other ecosystems because it’s flexible, fast, and scriptable.
🔍 Gradle vs Gradle Wrapper (gradlew
)
You might see both gradle
and ./gradlew
. What’s the difference?
gradle
requires Gradle to be installed globally on your machine../gradlew
(Gradle Wrapper) is a project-specific version. It ensures that everyone working on the project uses the same Gradle version, even if they don’t have it installed.
Always prefer using
./gradlew
for consistency!
🧱 What Does "Building the Application" Mean?
"Building" in software is like cooking in the kitchen. Here's how:
Phase | Cooking Analogy | Software Analogy |
Recipe writing | Writing steps in a cookbook | Writing your Java/Kotlin/Android code |
Ingredients | Spices, oil, veggies | External libraries (dependencies) |
Cooking | Following steps in the kitchen | Compiling your code |
Plating the food | Arranging nicely on a plate | Packaging the code into a .jar or .exe |
Serving | Eating the food | Running the application |
So, building is the process of transforming your raw code into a working application.
🛠️ The Command Breakdown
Let’s understand each line of a typical setup:
🔧 ./gradlew installDist
This command:
Compiles your application code
Pulls any required libraries (dependencies)
Builds a runnable version of your app
Places it inside the
build/install
directory
👉 After this, your app is ready to be run locally.
🌐 export AD_PORT=8080
This sets an environment variable called AD_PORT
to the value 8080
.
✅ Think of this as:
"Hey app, please run on port 8080 when you start."
⚙️ export FEATURE_FLAG_GRPC_SERVICE_ADDR=featureflagservice:50053
Another environment variable.
This one tells the app where to find the Feature Flag service it needs to connect to.
✅ Example:
“Your feature flag service is running on host
featureflagservice
and port50053
.”
▶️ ./build/install/opentelemetry-demo-ad/bin/Ad
This is the final step:
Run your application using the script that was built in the installDist
step.
✅ The app reads the environment variables and starts running with those configurations.
🗂️ Folder Structure After Build
After installDist
, you’ll typically get:
build/
└── install/
└── opentelemetry-demo-ad/
├── bin/
│ └── Ad <- Your runnable app
└── lib/
└── (all your app's dependencies)
💡 Why This Matters
Understanding Gradle helps you:
Customize your builds
Automate repetitive tasks
Handle dependencies better
Collaborate effectively on projects
🙌 Wrapping Up
If you’re just getting started with Gradle and app development, don’t stress about the complexity. Use analogies like cooking, experiment in small steps, and explore the generated folders to get a feel of what’s happening under the hood.
Have questions or want a visual breakdown in the next post? Drop a comment 💬
Subscribe to my newsletter
Read articles from Srishti Srivastava directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
