Android Clean Architecture in Rorty is a sample project that presents modern, approach to Android application development using Kotlin and latest tech-stack.

Last update: May 10, 2022

CodeStyle Compose Kotlin Android API Gradle License Apache 2.0

Jet Rorty Android

Android Clean Architecture in Rorty is a sample project that presents modern, approach to Android application development using Kotlin and latest tech-stack.

The goal 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. This application may look simple, but it has all of these small details that will set the rock-solid foundation of the larger app suitable for bigger teams and long application lifecycle management.

An android app built using Kotlin that consumes Rick and Morty API to display characters,episodes,Location from the TV Series. It has been built following Clean Architecture Principle, Repository Pattern, MVVM Architecture in the presentation layer as well as Jetpack components.

Environment Setup

You require the minimum Android Studio Bumblebee (2021.1.1) to be able to build the app.

Architecture

A well planned architecture is extremely important for an app to scale and all architectures have one common goal- to manage complexity of your app. This isn't something to be worried about in smaller apps however it may prove very useful when working on apps with longer development lifecycle and a bigger team.

Clean architecture was proposed by Robert C. Martin in 2012 in the Clean Code Blog and it follow the SOLID principle.

Clean Architecture

The circles represent different layers of your app. Note that:

  • The center circle is the most abstract, and the outer circle is the most concrete. This is called the Abstraction Principle. The Abstraction Principle specifies that inner circles should contain business logic, and outer circles should contain implementation details.

  • Another principle of Clean Architecture is the Dependency Inversion. This rule specifies that each circle can depend only on the nearest inward circle ie. low-level modules do not depend on high-level modules but the other way around.

Clean Architecture Diagram

Why Clean Architecture?

  • Loose coupling between the code - The code can easily be modified without affecting any or a large part of the app's codebase thus easier to scale the application later on.
  • Easier to test code.
  • Separation of Concern - Different modules have specific responsibilities making it easier for modification and maintenance.

S.O.L.I.D Principles

  • Single Responsibility: Each software component should have only one reason to change – one responsibility.

  • Open-Closed: You should be able to extend the behavior of a component, without breaking its usage, or modifying its extensions.

  • Liskov Substitution: If you have a class of one type, and any subclasses of that class, you should be able to represent the base class usage with the subclass, without breaking the app.

  • Interface Segregation: It’s better to have many smaller interfaces than a large one, to prevent the class from implementing the methods that it doesn’t need.

  • Dependency Inversion: Components should depend on abstractions rather than concrete implementations. Also higher level modules shouldn’t depend on lower level modules.

Layers

Project Structure

Project Structure

BuildSrc

The buildSrc layer is responsible for dependency management. It control and manage all dependencies in one place with Kotlin.

Common

The common layer is responsible for common properties. It contains the implementations of the resources files, themes and components declared in the common layer.

  • component: This is responsible for common view components that using app.

  • provider: Defines navigation, resource and theme provider.

  • theme: Defines themes, colors, fonts and resource files.

Libraries

The libraries layer is responsible for base structure.

  • framework: Contains different utilities that can be used by the different modules and base structures.

  • jetframework: Contains different utilities that can be used by the different modules and base structures only for Jet Compose.

  • testing: Contains the definitions of the test utilities.

Data

The data layer is responsible for selecting the proper data source for the domain layer. It contains the implementations of the repositories declared in the domain layer.

Components of data layer include:

  • model

    -dto: Defines dto of ui model, also perform data transformation between domain, response and entity models.

    -local: Defines the schema of SQLite database.

    -remote: Defines POJO of network responses.

  • local: This is responsible for performing caching operations using Room.

  • remote: This is responsible for performing network operations eg. defining API endpoints using Retrofit.

  • repository: Responsible for exposing data to the domain layer.

Domain

This is the core layer of the application. The domain layer is independent of any other layers thus ] domain business logic can be independent from other layers.This means that changes in other layers will have no effect on domain layer eg. screen UI (presentation layer) or changing database (data layer) will not result in any code change withing domain layer.

Components of domain layer include:

  • usecase: They enclose a single action, like getting data from a database or posting to a service. They use the repositories to resolve the action they are supposed to do. They usually override the operator invoke , so they can be called as a function.

Presentation

The features layer contains components involved in showing information to the user. The main part of this layer are the views(activity, compose) and ViewModels.

Demo Screenshots

Mode Splash OnBoarding - Intro
Light
Dark
Mode Characters Character Favorites Character Detail
Light
Dark
Mode Episodes Episode Favorites Episode Detail
Light
Dark
Mode Locations Location Favorites Location Detail
Light
Dark
Mode Settings About Language
Light
Dark

Tech Stacks

This project uses many of the popular libraries, plugins and tools of the android ecosystem.

  • Compose

    • Material - Build Jetpack Compose UIs with ready to use Material Design Components.
    • Foundation - Write Jetpack Compose applications with ready to use building blocks and extend foundation to build your own design system pieces.
    • UI - Fundamental components of compose UI needed to interact with the device, including layout, drawing, and input.
    • ConstraintLayout - ConstraintLayout-compose 1.0 provides ConstraintLayout functionalities in Jetpack Compose.
    • Lifecycle-ViewModel - Perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
    • Paging - The Paging Library makes it easier for you to load data gradually and gracefully within your app's RecyclerView.
    • Lottie - Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations exported as json with Bodymovin and renders them natively on mobile!
    • Coil - An image loading library for Android backed by Kotlin Coroutines.
  • Accompanist

    • SwipeRefresh - A library which provides a layout which provides the swipe-to-refresh UX pattern, similar to Android's SwipeRefreshLayout.
    • Systemuicontroller - System UI Controller provides easy-to-use utilities for updating the System UI bar colors within Jetpack Compose.
    • Insets - Insets for Jetpack Compose takes a lot of the ideas which drove Insetter for views, and applies them for use in composables.
    • Placeholder - A library which provides a modifier for display 'placeholder' UI while content is loading.
    • Navigation - A library which provides Compose Material support for Jetpack Navigation Compose. This features composable bottom sheet destinations.
  • 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.
    • Lifecycle - Perform actions in response to a change in the lifecycle status of another component, such as activities and fragments.
    • 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.
    • Room - Provides an abstraction layer over SQLite used for offline data caching.
    • Paging3 - The Paging Library makes it easier for you to load data gradually and gracefully within your app's RecyclerView.
  • Dagger Hilt - Dependency Injection library.

  • Google-KSP - Kotlin Symbol Processing API

  • Retrofit - Type-safe http client and supports coroutines out of the box.

  • OkHttp-Logging-Interceptor - Logs HTTP request and response data.

  • Coroutines - Library Support for coroutines.

  • Flow - Flows are built on top of coroutines and can provide multiple values. A flow is conceptually a stream of data that can be computed asynchronously.

  • Material Design - Build awesome beautiful UIs.

  • Coroutines - Library Support for coroutines,provides runBlocking coroutine builder used in tests.

  • Timber - A logger with a small, extensible API which provides utility on top of Android's normal Log class.

  • Moshi - A modern JSON library for Kotlin and Java.

  • Chucker - An HTTP inspector for Android & OkHTTP (like Charles but on device).

  • Gradle Kotlin DSL - makes it easy to manage dependency all module that we have

  • Navigation - Annotation processing library for type-safe Jetpack Compose navigation with no boilerplate.

  • SplashScreen - Android 12 adds the SplashScreen API, which enables a new app launch animation for all apps when running on a device with Android 12 or higher.

  • Test

    • Robolectric - Running tests on an Android emulator or device is slow! Building, deploying, and launching the app often takes a minute or more. That’s no way to do TDD. There must be a better way.
    • Mockk - A modern Mockk library for UnitTest.
    • Turbine - Turbine is a small testing library for kotlinx.coroutines Flow.
    • Truth - Truth makes your test assertions and failure messages more readable.
    • Coroutine-Test - Provides testing utilities for effectively testing coroutines.
    • ...

Plugin

Code Analyze Tools

  • Ktlint - A ktlint gradle plugin. Provides a convenient wrapper plugin over the ktlint project.
  • Spotless - It’s pretty useful in automating fixes for pretty simple (and common) formatting mistakes as in spaces, newlines, removing unnecessary imports, etc.
  • Detekt - Static code analysis for Kotlin.

🚀 Posts In Medium

Article

🤝 Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Open an issue first to discuss what you would like to change.
  2. Fork the Project
  3. Create your feature branch (git checkout -b feature/amazing-feature)
  4. Commit your changes (git commit -m 'Add some amazing feature')
  5. Push to the branch (git push origin feature/amazing-feature)
  6. Open a pull request

Please make sure to update tests as appropriate.

✍️ Authors

👤 developersancho

Linkedin Medium

Feel free to ping me 😉

License

Copyright © 2022 - 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.

GitHub

https://github.com/developersancho/JetRorty.Android
You might also like...

A sample project demonstrating clean architecture in an Android app

A sample project demonstrating clean architecture in an Android app

Android Clean Architecture Sample A sample project demonstrating clean architecture in an Android app Tech stack Kotlin Coroutines Flow Jetpack App St

May 19, 2022

A fork of our clean architecture boilerplate, this time using the Android Architecture Components

Android Clean Architecture Components Boilerplate Note: This is a fork of our original Clean Architecture Boilerplate, except in this repo we have swi

May 16, 2022

Android application showcasing the MVVM architecture, Clean code using Kotlin, Coroutine, Flow and databinding.

Android application showcasing the MVVM architecture, Clean code using Kotlin, Coroutine, Flow and databinding.

Code4Lyst Android application showcasing the MVVM architecture, Clean code using Kotlin, Coroutine, Flow and databinding. App Architecture MVVM CleanC

Nov 29, 2021

An android boilerplate project using clean architecture

Android Clean Architecture Boilerplate Welcome 👋 We hope this boilerplate is not only helpful to other developers, but also that it helps to educate

May 21, 2022

Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android.

Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android.

Klimatic Klimatic is an android app built using Kotlin. It try to showcase all the latest technologies used in android. Built using Android Architectu

May 2, 2022

Glue QA Tech Challenge with kotlin

Glue QA Tech Challenge Summary For this challenge, we have prepared an app that tells you whether you are legally allowed to drink in the UK based on

Oct 13, 2021

Cleanarchitecture MVVM Hilt base - Android Clean Architecture example project

Cleanarchitecture MVVM Hilt base - Android Clean Architecture example project

Android Clean Architecture example project Note: This is project based on MVVM c

Apr 10, 2022

Practice Project with Clean architecture(offline +online)

Dictionary-App Basically this project will save what you search once in dictionary and then if you will search the same word again in search when ther

Dec 6, 2021

Note taking app using SOLID principles and CLEAN architecture patterns. Uses Room database, MVVM, Use cases

ShoppingNotes Note taking app using SOLID principles and CLEAN architecture patt

Dec 27, 2021
Comments
  • 1. Task :buildSrc:compileKotlin FAILED

    Task :buildSrc:compileKotlin FAILED e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-compose.gradle.kts: (11, 1): Expression 'android' cannot be invoked as a function. The function 'invoke()' is not found e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-compose.gradle.kts: (11, 1): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: internal val ComPluginGroup.android: ComAndroidPluginGroup defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPlatformPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt internal val PluginDependenciesSpec.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-compose.gradle.kts: (12, 5): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: public fun CommonExtension<*, *, *, *>.addComposeConfig(): Unit defined in extensions in file CommonExtensions.kt e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (11, 1): Expression 'android' cannot be invoked as a function. The function 'invoke()' is not found e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (11, 1): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: internal val ComPluginGroup.android: ComAndroidPluginGroup defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPlatformPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt internal val OrgJetbrainsKotlinPluginGroup.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt internal val PluginDependenciesSpec.android: PluginDependencySpec defined in gradle.kotlin.dsl.plugins._466e4a4700bc37c094a10aeb87c8c736 in file PluginSpecBuilders.kt e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (12, 5): Unresolved reference: compileSdk e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (14, 5): Unresolved reference: defaultConfig e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (15, 9): Unresolved reference: minSdk e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (16, 9): Unresolved reference: targetSdk e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (17, 9): Unresolved reference: testInstrumentationRunner e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (18, 9): Unresolved reference: consumerProguardFiles e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (21, 5): Unresolved reference: buildTypes e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (22, 9): Unresolved reference: release e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (23, 13): Unresolved reference: isMinifyEnabled e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (24, 13): Unresolved reference: proguardFiles e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (25, 17): Unresolved reference: getDefaultProguardFile e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (28, 13): Unresolved reference: buildConfigField e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (29, 13): Unresolved reference: buildConfigField e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (32, 9): Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: public inline fun CompileOptions.debug(vararg debugArgs: Pair<String, Any?>): CompileOptions defined in org.gradle.kotlin.dsl e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (33, 13): Unresolved reference: buildConfigField e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (34, 13): Unresolved reference: buildConfigField e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (38, 5): Unresolved reference: compileOptions e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (39, 9): Unresolved reference: sourceCompatibility e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (40, 9): Unresolved reference: targetCompatibility e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (43, 5): Unresolved reference: kotlinOptions e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (44, 9): Unresolved reference: jvmTarget e: /Users/JetRorty.Android/buildSrc/src/main/java/commons/android-library.gradle.kts: (45, 9): Unresolved reference: freeCompilerArgs

    Reviewed by freemmer at 2022-03-23 00:53
Delish, a Food Recipes App in Jetpack Compose and Hilt based on modern Android tech-stacks and MVVM clean architecture.
Delish, a Food Recipes App in Jetpack Compose and Hilt based on modern Android tech-stacks and MVVM clean architecture.

Delish Screens Tech stack & Open-source libraries 100% Kotlin based + Coroutines + Flow for asynchronous. Dagger Hilt 2.37 Accompanist JetPack Jetpack

May 15, 2022
📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.
📒 NotyKT is a complete 💎Kotlin-stack (Backend + Android) 📱 application built to demonstrate the use of Modern development tools with best practices implementation🦸.

NotyKT ??️ NotyKT is the complete Kotlin-stack note taking ??️ application ?? built to demonstrate a use of Kotlin programming language in server-side

May 20, 2022
REST countries sample app that loads information from REST countries API V3 to show an approach to using some of the best practices in Android Development.
REST countries sample app that loads information from REST countries API V3 to show an approach to using some of the best practices in Android Development.

MAJORITY assignment solution in Kotlin via MVVM Repository Pattern. REST countries sample app that loads information from REST countries API V3 to sho

Dec 18, 2021
Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android applications.
Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android applications.

Compose Multi-Module Architecture Sample Sample project that shows an approach for designing a multi-module architecture for Jetpack Compose Android a

May 3, 2022
Skeleton project for show the architecture of Android project using MVVM, Clean Architecture and Kotlin coroutine Flow
Skeleton project for show the architecture of Android project using MVVM, Clean Architecture and Kotlin coroutine Flow

ClearScoreDemo Skeleton project for showing the architecture of Android project using MVVM, Clean architecture and Kotlin coroutine Flow App Architect

Mar 6, 2022
Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Unit tests etc.
Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Unit tests etc.

MoneyHeist-Chars Sample application to demonstrate Multi-module Clean MVVM Architecture and usage of Android Hilt, Kotlin Flow, Navigation Graph, Room

May 19, 2022
🚀 Sample Android Clean Architecture on JetRorty App focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack with Compose.
🚀 Sample Android Clean Architecture on JetRorty App focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack with Compose.

Android Clean Architecture in Rorty is a sample project that presents modern, approach to Android application development using Kotlin and latest tech-stack.

May 12, 2022
Rick-and-morty-app - Android mobile application development with clean architecture
Rick-and-morty-app - Android mobile application development with clean architecture

Android - Rick And Morty App MVVM architecture Dependency Injection (Dagger) Ret

Jan 27, 2022
ATH Sample is a sample Authentication and Authorization Application with Kotlin Language and MVVM architecture.
ATH Sample is a sample Authentication and Authorization Application with Kotlin Language and MVVM architecture.

ATH Sample ATH Sample is a sample Authentication and Authorization Application with Kotlin Language and MVVM architecture. Overview ATH Sample is a sa

Jun 8, 2021
Sample Android Clean Architecture on App focused on written in Kotlin, following best practices using Jetpack with Compose.
 Sample Android Clean Architecture on App focused on written in Kotlin, following best practices using Jetpack with Compose.

Rick And Morty Jetpack Compose Sample App Table of Contents About the Project Architecture Features Environment Setup Contact About The Project This S

May 19, 2022