How does Gradle Work for Android Apps?

What is gradle

What is it?

If you’ve ever used Android Studio, you’ve no doubt seen the word Gradle thrown all over.  It’s one of those things that seems really important even though you don’t know much about it.  And if you are anything like me, you kind of just hope it will keep working…whatever it is.  I’m going to clear up what Gradle is, why it is so important, and why you don’t need to live in fear of it anymore.

What is it?

According to Wikipedia,

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL)…”

While accurate, it’s still a little cryptic and it sure doesn’t make Gradle look any less scary.  Let’s break this down further.

Gradle is open source

Open source simply means that the source code that makes up the program is available for free to whoever wants it and they can do whatever it is they want with it.  This is as opposed to closed source which is what commercial software is; the code is private to the company that created it.

Gradle is a build automation system…

In software, a build is just as it is in any other part of life; the construction of a tangible object.  But in software development, the tangible product is the piece of software which is made of many other files like the source code.  When put together in the correct order, these files come together to make an executable program, more commonly known as an app.

With just a build system, the developer has to manually compile all of the files.  This isn’t so much of a task with small programs with just a few source files, but as programs grow larger and larger and require more resources like images, sounds, screen layouts, etc., it becomes a lot of work to compile a program.  This is where the automation comes in to play.

Believe it or not, a lot of work goes in to combining all of these files to make a program run.  And before these processes could be automated, instructions had to be written by the developer on how to compile the program and this was not done with a nice code editor like Android Studio.  By automating this process, human error is removed and production time is greatly sped up.  Think how many times you hit that play button in a single sitting!

…Builds upon the concepts of Apache Ant and Apache Maven…

Ant is a command-line build system written in java that can be used to build non java applications like C or C++.

Maven is another build automation system meant for any java based project.  Maven’s main goals are to create easy, uniform build systems in the most productive way possible.  Sounds pretty good right?

So basically we have these two tried and true systems that build java apps, now let’s make Gradle improve on them.

…Introduces a Groovy-type…

Groovy, like java, is an object oriented programming language that is meant to work with other java code and libraries.  It omits the commonly used parentheses and periods from java syntax which results in a very human readable context.

…domain specific language (DSL)…

A domain specific language is a programming language made for a specific purpose which in this case is Android development.  So a Groovy-type domain specific language means an object oriented programming language made specifically for the Android platform.  Kind of cool, huh?

So if we were to make the Wikipedia definition simpler, we could say that Gradle is a tool that creates our app using all of the files we have created for it based on methods proven to work by similar tools before it.

That’s a little easier right?

Why two Gradle files?

1I’m sure you’ve noticed by now that there are two Gradle files inside of you Android Studio project, one with the description of “Project” and one with the description of “Module”.  When you start your Android Studio project, you start it with one module.  A single Android studio project can have multiple modules.  Therefore the Project Gradle file are the build instructions for the whole app and the Module Gradle file are the build instructions for just one module of your app.







Hopefully that clears up a little bit about what Gradle is.  It doesn’t have to be as scary as you may think it is and maybe now you’ll have an introductory understanding in why it is there.  However there are all sorts of things you can do with it.  Configuring Gradle builds allows you to create free and paid versions of your app, debug and release versions, and much more.  But alas, that is content for another day.


Define your Minimum Viable Product (MVP)

Minimum Viable Product

Why is this important?

I'm going to explain this in a little case study of my own Android development history.  It wasn't until I heard the concept of the minimum viable product that I really started to buckle down on my app and get something in the market.

Take time to learn

It took me a very long time to get my first app published.  Probably the better part of five years.  This was not because my first app was so complex and had so many features.  It was not because it required a lot of research from professionals and users.  It was nothing I wished it would have been.  Instead it was because I wouldn't take "less than" as acceptable.  I wanted my app to have every feature, all of the bells and whistles.  I kept thinking of ideas to add.  But then my app would get too big.  There would be too much code in too many places and seeing as how I was so early in my programming career, my skills would improve so quickly it became easier to start over than to correct old code. 

This is okay.  All good things take time to accomplish.  I wanted my first app to be the one that everybody talked about, the one that would sell for millions.  Again, not realistic.  What's realistic is taking the time to learn the steps to get me to this app.  And I honestly see it in my future, maybe not quite at that scale, and I sure won't be the only one behind it, but I know it is possible.

Don't get intimidated; keep coding

So I would start making a new app, a different app.  Something that wasn't even close to the original because that idea obviously didn't work.  I'd get a little further in to the development process than the previous one.  I'd spend hours upon hours focusing on tiny details instead of the big picture and I'd inevitably wind up in the same predicament.  It just didn't seem realistic to be able to bring an app to market.  Everything had to be perfect and I'm just one guy! And every day I'd hear about another wildly successful app, another team that made it.  They brought an amazing idea to market.  How did they do it?  I guarantee the majority of people that find success in Android development, or any software development for that matter, don't strike gold on their first try.  They had to start somewhere. 

MVP to the rescue!

Then near the beginning of my first published app, Don't Forget It, I heard something on an entrepreneurial podcast I listen to, Entrepreneur On Fire.  I don't remember who said it but I heard the concept of a Minimum Viable Product for the first time.  This is commonly abbreviated MVP.  An MVP is essentially the most basic version of the product you want to bring to market.  It was the minimum amount of features, bells and whistles, look, usability, etc. required to have something you can be proud to say you made and that you can put in front of potential customers.  It doesn't have to be great but it has to work.

This changed my world.  I couldn't believe people would do that.  I just assumed that would be a horrible idea.  Why would I think anyone would like anything but the best from me?

Well, a few reasons.

  1. I have no customers.  I thought if I build it, they will come.  Not the case.
  2. I have no idea what the app publishing process really entailed.  Or the marketing process.  Or the testing process.  And I don't take advice well.  I need to do it myself.
  3. I need to prove to myself, as a morale boost if nothing else, that I am capable of publishing an app.  Nobody else whose done it before me has anything I don't.  They can't do anything I can't.

For someone new to publishing apps, there is a lot to be gained by going through the process.  The whole process.  I knew Don't Forget It wouldn't be my last app.  In fact, when I started it, I never really intended on publishing it.  I just needed the tool for myself.  But once it started to become a real thing, I immediately thought I should throw in all of those bells and whistles.  But that's not realistic.  What I needed was just something to put on the store.  I needed some content in the world.  I needed a win and that's exactly what this was.  If there's a lesson I've learned from this, it's this: until you have something to show for your work, something that might attract the attention of someone else, you're not much farther ahead than when you started.



5 Things I Learned After Publishing My First App

I recently just published my first app, Don't Forget It.  The purpose of the app is to be able to quickly log all of those little tasks that come up throughout the day, picking up your prescription, calling a friend on the way home from work, things like that.  It came to me out of necessity.  I have a terrible memory and I have to do something about it.  It was an amazing process to go from a blank program to a fully working app but I could have made the last six months a little easier if I kept these things in mind.

1. It will never be perfect

It seemed that when I started the app, I had a very clearly defined goal of what I wanted the app to do.  As I continued writing it, I kept thinking of new features to add.  Some of the ideas were better than others but I was starting to lose the main focus of the app: log those tasks QUICKLY.  So I had to pick and choose which features to keep and which to get rid of.  But the real trouble lies underneath.  I am a team of one so with every feature that gets added, there is added time for implementation, testing, debugging, more testing, and so on.  I had to focus on that MVP (Minimum Viable Product) and get the app out the door.  There will be plenty of time to add the features later.  Having an app in the app store, especially the first one, is already a huge win.

2. Test test test

I almost published the app a month ahead of the actual date and that would have been a horrible thing.  I was antsy.  I just wanted to get it done already.  Late nights and early morning programming sessions were starting to wear on me and I was in a hurry.  But lucky for me, I am a little too much of a perfectionist.  I tested the app on my own phone for about two weeks every day before I even gave it to a friend to test.  And it was good that I did.  Software these days is held to an incredibly high standard.  How many times have you used an app or webpage, found one unresponsive feature, or something that just didn't work and said "I'm not coming back".  I sure have.  Take time to test.

3. You need some graphics

For some reason I forgot that once the app was ready to publish, I'd still need promotional material.  A few images at a bare minimum.  It's quick and easy but before you get blindsided by anything, make sure you have these ready to when you publish your app to the Google Play store.

  • At least five screen shots
  • Hi-res icon: 512 x 512, 32-bit PNG (with alpha)
  • Feature Graphic: 1024 wide x 500 high, JPG or 24-bit PNG (no alpha)
  • Promo Graphic: 180 wide x 120 high, JPG or 24-bit PNG (no alpha)
  • TV Banner: 1280 wide x 720 high, JPG or 24-bit PNG (no alpha)

And if you can do it, a little promo video is a great idea as well.

4. It's not as hard as it sounds

Honestly, it's not.  Persistence is the key.  Just don't give up.  Yes, there are plenty of apps in the app store.  Yes, there are a lot of scary statistics telling you odds of being the next Facebook are pretty low.  But you miss 100% of the shots you don't take (Wayne Gretzky).  You also don't make 100% of the shots you take.  More shots, more chances.  And just the feeling of having something in the world that anybody, anywhere can see is an amazing feeling.

5. Tell Everyone you know

I'm not big on self promotion.  In fact, I hate it.  But a little encouragement can go a long way.  It was about two weeks before I made a Facebook post about my app but when I did, the results were amazing.  Not amazing in the sense that it put Don't Forget It on the map, but amazing in the sense that a lot of my friends were happy for me.  They downloaded my app, gave me feedback, and just made me feel like waking up at 5 in the morning to program before work was kind of worth it. 
It's a long ride but well worth it.  I hope this serves as a little encouragement for someone looking to get into app development, or maybe needs a kick in the butt to finish theirs.  Good luck!

We just published our first app!

Don’t Forget It!  Our first app is in the Google Play Store.  This one was developed out of necessity for us and it’s what really launched Bag of Tricks Studios.  So many little tasks come up during the day that need to be dealt with by the end of the day.  But when our mind is engaged in something else, it’s easy to overlook the little things.  Enter Don’t Forget It (dun dun dun…).  This is the app that will take care of all of that.  When you’re deep in thought, working hard on a project, and you get a phone call asking you to pick up milk on the way home, Don’t Forget It is the easiest way to make sure you, well, don’t forget it.  In just a few clicks, open the app, type in “Get Milk”, set a reminder for 5:00 when you leave work, and you’re done.  You don’t need to clutter up your Google Calendar with little tasks.  You don’t need to write a post it note that you’re just going to lose anyway.  You don’t need to email yourself a reminder and have it get lost in the chaos of your inbox.  Don’t Forget It will remind you when it’s time and you’ll be on your way.  Get it here!