An MVVM Boilerplate Android project written in Kotlin. This sample application fetches the top starred Kotlin repositories from Github and displays them. Inspired by @hitherejoe's Android-Boilerplate project.
Note: This project was developed before Google's introduction of Android Architecture Components at I/O 2017. I strongly encourage that you read their application architecture guide.
To compile and run the project you'll need:
- Android SDK
- Android N (API 25)
- Android SDK Tools
- Android SDK Build Tools
24.0.3 - Android Support Repository
- Kotlin
1.0.6 - Kotlin plugin for Android Studio
To build, install and run a debug version, run this from the root of the project:
./gradlew assembleDebug
To run unit tests on your machine:
./gradlew test
To run instrumentation tests on connected devices:
./gradlew connectedAndroidTest
A release build needs to be signed with an Android Keystore. The easiest way to generate a keystore is to open
Android Studio and go to Build -> Generate Signed Apk -> Create New... After that you need to create a
signing.properties file in the root directory and add the following info to it:
STORE_FILE=/path/to/your.keystore
STORE_PASSWORD=yourkeystorepass
KEY_ALIAS=projectkeyalias
KEY_PASSWORD=keyaliaspasswordRunning ./gradlew assembleRelease will then build and sign a release version of the app.
In a nutshell, Kotlin throws all the bad parts of Java out the window and brings lots of great features from Java 8 and functional programming (Yet still compiling to Java 6 bytecode). Kotlin brings much needed language features to Android which is stuck on Java 6.
By default Kotlin classes are closed (final). This makes them hard to mock unless you use a tool like
Powermock. I'd rather just mock interfaces with Mockito
than go through the hassle of using Powermock.
Update: Mockito 2.0 Supports mocking static and final out of the box. Thus, it removes the need for all of these interfaces.
This is a boilerplate project aimed to help bootstrap new Kotlin applications. Feel free to fork this application or use this project generator. Don't forget to change the following things for your application:
- Application ID (Gradle)
- Application Name (String resource)
- Package names




