While the template was made in 2019
, it holds up well in 2020
, however there are more cool stuff came around since then.
You should always refer to Google's official projects for pointers. Here are some relevant references:
- https://developer.android.com/jetpack and https://developer.android.com/jetpack/androidx/versions
- https://github.com/android/sunflower
- https://github.com/android/architecture-samples
- https://github.com/chrisbanes/tivi
- https://github.com/cortinico/kotlin-android-template
- https://medium.com/@hossainkhan/how-to-take-your-beginner-android-skills-to-the-next-level-by-studying-open-source-android-apps-713d55c5094
A barebone MVVM architecture based Android project with some essential tools configured the right* way. See Android Architecture Blueprints v2 for more comprehensive app architecture example.
Inspiration: The architecture is inspired by combination of different project by Google and Android Community, such as:
- Github Browser - Sample project from Android Architecture Components repository
- Todo MVVM LiveData App - Todo app by Android Architecture Blueprints
- Android Blueprints v2 - Modern Architecture - Todo app using all the modern libraries like Architecture Components, Navigation, MVVM and so on.
There are few essentials that are added to the project. Best way to see what is included is to check the latest dependecies from app/build.gradle
Here are list of dependencies included:
- AndroidX
- AppCompat
- Material Theme
- ViewModel
- Lifecycle
- ConstraintLayout
- ViewPager 2
- Kotlin Extensions (KTX)
- Firebase Crashlytics
- Firebase Analytics
- Timber - android logging
Dagger 2-dependency injection for Activity and FragmentUpgraded to Dagger Hilt (alpha), see PR#38- RxJava 3 - ReactiveX Java
- Retrofit 2 - REST API
- OkHttp - with logging interceptor
- Gson - JSON response parsing
- Mockito - unit test mocking
- Leak Canary 2 - automatic memory leak detection
- Kt Lint Format - An anti-bikeshedding Kotlin linter with built-in formatter
You may need to delete optional features based on your need.
- CircleCI integration for CI/CD.
- You must create a Firebase project and use the
google-services.json
from your project. A placeholder google-services.json is provided so that app compiles. - You must update package name and application ID where applicable.
- Remove feature
X
,Y
, andY
activities and related resources. However, it may be beneficial to keep them as reference point at initial phase of the project. - Remove fragment
A
,B
, andC
and related files like ViewModel and Layout files. - Remove unused libraries that are added in app/build.gradle
- Also update your application's theme color. See styles.xml
Currently the barebone app has following sample activities:
MainActivity
- Hosts fragments usingViewPager
and navigates usingBottomNavigationView
.Feature X
- showcases how REST call is made using injected service in ViewModel.Feature Y
- showcases how RecyclerView can be used in conjunction with DiffUtils.Feature Z
- showcases how Fragment can also have injection and use service in ViewModel.