|
| 1 | +--- |
| 2 | +layout: post |
| 3 | +title: "Jumpstarting Android Projects" |
| 4 | +date: 2017-09-28 05:00:00 |
| 5 | +author: anuj |
| 6 | +categories: Technical Android |
| 7 | +--- |
| 8 | + |
| 9 | +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 |
| 10 | + |
| 11 | +* dependencies correctly, |
| 12 | +* networking, |
| 13 | +* dependency injection, |
| 14 | +* base classes, |
| 15 | +* build types, |
| 16 | +* version number auto increment and |
| 17 | +* a million other small things? |
| 18 | + |
| 19 | +And then to do it for every new project you start, that is hours and hours of wasted effort. |
| 20 | + |
| 21 | +<img src="https://media.giphy.com/media/l46CbAuxFk2Cz0s2A/giphy.gif" /> |
| 22 | + |
| 23 | +Well, not any more. |
| 24 | + |
| 25 | +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. |
| 26 | + |
| 27 | +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](https://github.com/moldedbits/argus-android), all within 5 minutes. |
| 28 | + |
| 29 | +<img src="https://media.giphy.com/media/6kvVGhp7bp2WA/giphy.gif" /> |
| 30 | + |
| 31 | +#### Step 1 - Setting up the base project |
| 32 | + |
| 33 | +*Time Required: 3 minutes* |
| 34 | + |
| 35 | +We have a python script to help with the initial setup. You can clone this [repo](https://github.com/moldedbits/JumpstartScript) on your machine and navigate to the folder on a terminal. |
| 36 | + |
| 37 | +``` |
| 38 | +$ git clone https://github.com/moldedbits/JumpstartScript |
| 39 | +$ cd JumpstartScript |
| 40 | +$ python android-jumpstart.py |
| 41 | +``` |
| 42 | + |
| 43 | +This will clone the repository [android-jumpstart](https://github.com/moldedbits/android-jumpstart) locally and then ask you two to customize it. |
| 44 | + |
| 45 | +``` |
| 46 | +... |
| 47 | +Enter new app name: JumpDemo |
| 48 | +... |
| 49 | +Enter new app package: com.moldedbits.jump |
| 50 | +... |
| 51 | +``` |
| 52 | +This will create a project for you in the folder _JumpDemo_ that is all set to be imported into Android Studio. |
| 53 | + |
| 54 | +__Voila, our base project all setup. Now fire up your Android Studio, import the project and start writing business logic.__ |
| 55 | + |
| 56 | +<img src="https://media.giphy.com/media/XreQmk7ETCak0/giphy.gif" /> |
| 57 | + |
| 58 | +Some of the features already implemented by this are, |
| 59 | + |
| 60 | +* Dependency injection with Dagger 2 |
| 61 | +* Networking with Retrofit |
| 62 | +* Gradle build types, signing keystore, dependencies, version code auto increment |
| 63 | +* Mocking framework for unit tests |
| 64 | + |
| 65 | +A detailed and updated list of the features is available on the [project page](https://github.com/moldedbits/android-jumpstart). |
| 66 | + |
| 67 | +#### Step 2 - Adding login (Optional) |
| 68 | + |
| 69 | +*Time Required: 2 minutes* |
| 70 | + |
| 71 | +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](https://github.com/moldedbits/argus-android). Including this is really simple. Follow the steps [here][argus-post] and you will have your login screen in less than two minutes. |
| 72 | + |
| 73 | +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. |
| 74 | + |
| 75 | +<img src="https://raw.githubusercontent.com/moldedbits/argus-android/master/images/ArgusLogin.png" alt="Demo Login" style="width: 300px; margin:auto;"/> |
| 76 | + |
| 77 | +And all of it took less than 5 minutes! |
| 78 | + |
| 79 | +<img src="https://media.giphy.com/media/5wWf7GW1AzV6pF3MaVW/giphy.gif" /> |
| 80 | + |
| 81 | +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. |
| 82 | + |
| 83 | +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. |
| 84 | + |
| 85 | +Happy coding! |
| 86 | + |
| 87 | +The moldedbits Team |
| 88 | + |
| 89 | +[argus-post]: http://eng.moldedbits.com/technical/android/2017/06/26/introducing-argus.html |
0 commit comments