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:
From our partners:
- 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:
<a class="af jd" href="https://github.com/android/architecture-templates/blob/base/" target="_blank" rel="noopener ugc nofollow">base</a>
— Reactive architecture, Compose, database, single module<a class="af jd" href="https://github.com/android/architecture-templates/blob/multimodule/" target="_blank" rel="noopener ugc nofollow">multimodule</a>
— 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!
- 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.
Thanks to Manuel Vivo
By Jose Alcérreca
Source Android
For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!
Our humans need coffee too! Your support is highly appreciated, thank you!