Do you remember the last time you setup an Android project? How long did it take you after creating a new android project from Android Studio to customize and scaffold it before you could write the first business logic? Did you remember to setup the
- dependencies correctly,
- networking,
- dependency injection,
- base classes,
- build types,
- version number auto increment and
- a million other small things?
And then to do it for every new project you start, that is hours and hours of wasted effort.
Well, not any more.
In the spirit of DRY, we have created an automated process at moldedbits to jumpstart Android projects and get started quickly. And in the spirit of open source, we are putting this out in the public domain.
Enough talk, lets code. We will demonstrate setting up an application with the dependencies, networking and dependency injection setup and the login implemented with Argus, all within 5 minutes.
Step 1 - Setting up the base project
Time Required: 3 minutes
We have a python script to help with the initial setup. You can clone this repo on your machine and navigate to the folder on a terminal.
$ git clone https://github.com/moldedbits/JumpstartScript
$ cd JumpstartScript
$ python android-jumpstart.py
This will clone the repository android-jumpstart locally and then ask you two to customize it.
...
Enter new app name: JumpDemo
...
Enter new app package: com.moldedbits.jump
...
This will create a project for you in the folder JumpDemo that is all set to be imported into Android Studio.
Voila, our base project all setup. Now fire up your Android Studio, import the project and start writing business logic.
Some of the features already implemented by this are,
- Dependency injection with Dagger 2
- Networking with Retrofit
- Gradle build types, signing keystore, dependencies, version code auto increment
- Mocking framework for unit tests
A detailed and updated list of the features is available on the project page.
Step 2 - Adding login (Optional)
Time Required: 2 minutes
Most apps require a login flow with email, phone and social logins. To further automate this, we have created another library to make our lives easier, Argus. Including this is really simple. Follow the steps here and you will have your login screen in less than two minutes.
And that is all. With this, we have setup an app with all the dependencies and scaffolding setup to get the developer started straight on the business logic of the app, and a basic login framework.
And all of it took less than 5 minutes!
The jumpstart is, by design, very opinionated about how android apps should be written. You can pick the things you like and change / delete the things you do differently.
We will continue working on the jumpstart project to keep it updated, so you can expect to see some changes in the future. As always, if you find anything that can be improved, we welcome you to create a github issue or better to create a pull request.
Happy coding!
The moldedbits Team