Introducing the Architecture Templates
We released a new project on Github called Android Architecture Starter Templates.
The goal of these templates is to get you started quickly when doing an experiment or starting a brand-new app from scratch. They follow the new Architecture recommendations that we released recently, which are a summary of the official Architecture guide.
These templates are not empty, they contain some opinions in the form of architectural patterns and used libraries:
- Room Database
- Dependency injection with Hilt
- Jetpack ViewModel
- UI using Jetpack Compose and Material3
- Jetpack Navigation
- Reactive data layer
- Kotlin Coroutines and Flow
- Unit tests
- UI tests using fake data with Hilt
- KTS gradle files
- Version catalog
- A simple UI that shows a list of saved items and lets the user save new ones.
A new template on Github? Why not include it in Android Studio?
Templates are bundled inside each Studio release and we want this project to always use the latest dependencies to get you started as quickly as possible. Having it on Github lets us automate maintenance with tools like Renovate.
Branches
Right now the repository contains two templates:
base
— Reactive architecture, Compose, database, single modulemultimodule
— Base template implemented in multiple modules
Requirements
The project includes a customizer.sh
script that renames files and packages, and cleans everything up. It works on Linux and macOS (with bash 4 and above). On Windows, you can use the Windows Subsystem for Linux. If you find any compatibility issues with the script, please file a bug.
Usage
- Clone the repository, optionally choosing a branch. For example, to check out the
base
branch:
git clone https://github.com/android/architecture-templates.git --branch base
2. Run the customizer script:
bash customizer.sh your.package.name DataItemType [YourAppName]
your.package.name
is your app ID (should be lowercase)DataItemType
is used for the name of the main screen, exposed state and data base entity (should be PascalCase).- Optionally, you can specify a name for your application (should be in PascalCase).
Note: the customizer script requires bash 4 and above. You might have to install a modern version on macOS:
brew install bash
Let us know what you think!
We'd like feedback on:
- The included libraries and overall functionality
- The customizer script
- Other variants that you might be missing
To report feedback, feel free to open a feature request or drop me a message.