Clean Android Architecture: Take a layered approach to writing clean, testable, and decoupled Android applications

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Learn how to build, maintain, and test Android applications using clean architecture principles

Key Features

  • Understand various software design principles and patterns to make an application more testable
  • Structure your application's code into different layers and components to make it more maintainable and flexible
  • Study popular libraries and frameworks and integrate them into an application

Book Description

As an application's code base increases, it becomes harder for developers to maintain existing features and introduce new ones. In this clean architecture book, you'll learn to identify when and how this problem emerges and how to structure your code to overcome it.

The book starts by explaining clean architecture principles and Android architecture components and then explores the tools, frameworks, and libraries involved. You'll learn how to structure your application in the data and domain layers, the technologies that go in each layer, and the role that each layer plays in keeping your application clean. You'll understand how to arrange the code into these two layers and the components involved in assembling them. Finally, you'll cover the presentation layer and the patterns that can be applied to have a decoupled and testable code base.

By the end of this architecture book, you'll be able to build an application following clean architecture principles and have the knowledge you need to maintain and test the application easily.

What you will learn

  • Discover and solve issues in Android legacy applications
  • Become well versed in the principles behind clean architecture
  • Get to grips with writing loosely coupled and testable code
  • Find out how to structure an application's code in separate layers
  • Understand the role each layer plays in keeping the application clean
  • Integrate existing frameworks and libraries for each layer

Who this book is for

This book is for Android developers who want to learn about managing the complexity of their applications, and is also highly recommended for intermediate or advanced Android developers looking for a go-to guide for clean architecture and the integration of various Android technologies. New developers familiar with the fundamentals of Android app development will find this book useful too.

Table of Contents

  1. Getting Started with Clean Architecture
  2. Deep Diving into Data Sources
  3. Understanding Data Presentation on Android
  4. Managing Dependencies in Android Applications
  5. Building the Domain of an Android Application
  6. Assembling a Repository
  7. Building Data Sources
  8. Implementing an MVVM Architecture
  9. Implementing an MVI Architecture
  10. Putting It All Together

Author(s): Alexandru Dumbravan
Edition: 1
Publisher: Packt Publishing
Year: 2022

Language: English
Pages: 368
City: Birmingham
Tags: Android; Kotlin; Android Framework; Data Sources; MVVM Architecture; MVI Architecture

Title page
Copyright and Credits
Foreword
Contributors
About the reviewers
Table of Contents
Part 1 – Introduction
Preface
Chapter 1: Getting Started with Clean Architecture
Technical requirements
The architecture of a legacy app
Legacy analysis
Software design principles
SOLID principles
Component cohesion principles
Component coupling principles
Exploring the evolution of Android
Fragments
The Gradle build system
Networking
Humble objects
Functional paradigms
Kotlin adoption
Dependency injection
Android architecture components
Coroutines and flows
Jetpack Compose
Enter clean architecture
Summary
Chapter 2: Deep Diving into Data Sources
Technical requirements
Understanding Kotlin coroutines and Flows
Kotlin coroutines
Exercise 02.01 – Using Kotlin coroutines
Kotlin Flows
Exercise 02.02 – Using Kotlin Flows
Using OkHttp and Retrofit for networking
Exercise 02.03 – Using OkHttp and Retrofit
Using the Room library for data persistence
Exercise 02.04 – Using Room to persist data
Understanding and using the DataStore library
Exercise 02.05 – Using DataStore to persist data
Summary
Chapter 3: Understanding Data Presentation on Android
Technical requirements
Analyzing lifecycle-aware components
Exercise 3.1 – Using ViewModel and LiveData
Using Jetpack Compose to build UIs
Exercise 3.2 – Navigating using Jetpack Compose
Summary
Chapter 4: Managing Dependencies in Android Applications
Technical requirements
Introduction to DI
Using Dagger 2 to manage dependencies
Using Hilt to manage dependencies
Exercise 04.01 – using Hilt to manage dependencies
Summary
Part 2 – Domain and Data Layers
Chapter 5: Building the Domain of an Android Application
Technical requirements
Introducing the app's architecture
Creating the domain layer
Exercise 05.01 – Building a domain layer
Summary
Chapter 6: Assembling a Repository
Technical requirements
Creating the data layer
Creating repositories
Exercise 06.01 – Creating repositories
Summary
Chapter 7: Building Data Sources
Technical requirements
Building and using remote data sources
Exercise 07.01 – Building a remote data source
Building and integrating local data sources
Exercise 07.02 – Building a local data source
Summary
Part 3 – Presentation Layer
Chapter 8: Implementing an MVVM Architecture
Technical requirements
Presenting data in Android applications
Presenting data with MVVM
Exercise 08.01 – Implementing MVVM
Presenting data in multiple modules
Exercise 08.02 – Multi-module data presentation
Summary
Chapter 9: Implementing an MVI Architecture
Technical requirements
Introducing MVI
Implementing MVI with Kotlin flows
Exercise 09.01 – Transitioning to MVI
Summary
Chapter 10: Putting It All Together
Technical requirements
Inspecting module dependencies
Exercise 10.01 – Reduce dependencies
Instrumentation testing
Exercise 10.02 – Instrumented testing
Summary
Index
Other Books You May Enjoy