/android-template

Android app starter template

Primary LanguageKotlin

ArchiTecture logo

test lint

Clean architecture with 3 layers

  • Data (for database, API and preferences code)
  • Domain (for business logic and models)
  • Presentation (for UI logic, with MVVM)

ArchiTecture logo

Tests

  • Unit tests
  • Application tests
  • Activity tests (with Espresso)
  • Application has a testing flag

Other useful features

  • Dependency injection (with Hilt)
  • Reactive programming with Kotlin Flows
  • Google Material Design library
  • Margins and Insets with Insetter
  • Logging (with Timber)
  • Android architecture components to share ViewModels during configuration changes
  • Edge To Edge Configuration
  • Resource defaults
    • themes.xml - app themes
    • themes.xml (v29) - app themes (for better edgeToEdge)
    • colors.xml - colors for the entire project
    • styles.xml - widget styles
    • styles-text.xml - text appearances

Getting started

Script

  1. Download this repository extract and open the folder
  2. Run newproject.sh script to create a copy with the name you want
    • Example: ./newproject.sh -p com.example.project -t Project
  3. On app/build.gradle, update the dependencies Android Studio suggests
  4. On theme.xml & colors.xml set your application primary and secondary colors

And you're ready to start working on your new app.

Manual

  1. Download this repository extract and open the template folder on Android Studio
  2. Rename the app package io.bloco.template
  3. Check if the manifest package was renamed along with the package
  4. On app/build.gradle, change the applicationId to the new app package
  5. On app/build.gradle, update the dependencies Android Studio suggests
  6. On string.xml, set your application name
  7. On theme.xml & colors.xml set your application primary and secondary colors

And you're ready to start working on your new app.

Notes

  • Jetifier is enabled inside gradle.properties. Even though it's not necessary for the current dependencies, it was left enabled so anyone can start using the template without worrying when to turn it on. We do recommend you to check Can I drop Jetifier? when expanding the template.
  • Android Template contains .github/workflows for lint check and unit testing. You can easily take this project worflow and repurpose it with a few path changes, you can also find a commented example in test.yml for Instrumentation Testing and CodeCoverage that we advice to keep a clean project, you will however need to replace the secret keys with your own.

More

If you want to know more you can check our blog post.