Skip to content

Example of Clean Architecture of Android app using MVVM, Koin, Coroutines, Retrofit, Room, Solid Principle, DRY, KISS, OOP

Notifications You must be signed in to change notification settings

developersancho/CleanArchitectureMVVM

Repository files navigation

New Version Of Clean Architecture MVVM

Rorty Native Android Project - you can reach here.

Rorty Native Android Medium Post - you can reach here.

CleanArchitectureMVVM

Kotlin Version Gradle API License

Example of Clean Architecture of Android app using MVVM, Koin, Coroutines, Retrofit, Room, Solid Principle, DRY, KISS, OOP, Unit Test

This Base Architecture project that presents modern, 2019 approach to Android application development using Kotlin

The trick of the project is to demonstrate best practices, provide a set of guidelines, and present modern Android Application Architecture that is modular, scalable, maintainable and testable, suitable for bigger teams and long application lifecycle management.

Environment setup

You require the latest Android Studio 3.6 RC1 (or newer) to be able to build the app.

Multi-Module -1

Module Structure

Multi-Module -2

Module Structure

Dependencies

  • Jetpack:
    • Android KTX - provide concise, idiomatic Kotlin to Jetpack and Android platform APIs.
    • AndroidX - major improvement to the original Android Support Library, which is no longer maintained.
    • Benchmark - handles warmup, measures your code performance, and outputs benchmarking results to the Android Studio console.
    • Data Binding - allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
    • View Binding - allows you to bind UI components in your layouts to data sources in your app using a declarative format rather than programmatically.
    • Lifecycle - perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
    • LiveData - lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services.
    • Navigation - helps you implement navigation, from simple button clicks to more complex patterns, such as app bars and the navigation drawer.
    • Room - persistence library provides an abstraction layer over SQLite to allow for more robust database access while harnessing the full power of SQLite.
    • ViewModel - designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.
  • Coroutines - managing background threads with simplified code and reducing needs for callbacks.
  • Coroutines-Flow - suspending functions asynchronously returns a single value, but how can we return multiple asynchronously computed values? This is where Kotlin Flows come in.
  • Koin - dependency injector for replacement all FactoryFactory classes.
  • Retrofit - type-safe HTTP client.
  • Glide - image loading and caching library for Android focused on smooth scrolling.
  • Gson - makes it easy to parse JSON into Kotlin objects.
  • Timber - a logger with a small, extensible API which provides utility on top of Android's normal Log class.
  • Gradle Kotlin DSL - makes it easy to manage dependency all module that we have
  • and more...

Test Dependencies

  • Robolectric - industry-standard unit testing framework for Android.
  • JUnit - a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.
  • Koin Test - project brings you small but powerfull tools to test your Koin application.
  • Coroutine Test - provides testing utilities for effectively testing coroutines.
  • and more...

Plugins

  • Versions - make easy to determine which dependencies have updates.
  • SafeArgs - generates simple object and builder classes for type-safe navigation and access to any associated arguments.

Contributions

All contributions are welcome! Please feel free to post questions, recommendations, ideas, bugs by create new issue following the template or if you want create directly new pull request.

Special Thanks

License

Copyright 2019 developersancho.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.