Skip to content

santimattius/android-architecture-guide

Repository files navigation

codecov Quality Checks

Android Architecture Guide Template

This is a template to build an Android app applying good practices and using a clean architecture, you will see that the code is super decoupled with external frameworks and even with the same Android framework, this will help you to model your domain purely in Kotlin without generating external dependencies.

App Capture

Application architecture

In the following images you will see how the app is built and what its levels of abstraction are.

Layers

general architecture

Android Architecture Guide

Architecture guide recommended by google for android

architecture layers

Basics checks

Run verification commands:

./gradlew app:check

or

./gradlew app:test

executing tests

Detekt

This project contains DeteKt configurations, run next command in your terminal.

./gradlew app:detekt

Jacoco

Run next command in your terminal for generate jacoco coverage report

./gradlew app:testDebugUnitTestCoverage

SonarQube

Install sonarqube using Home brew

brew install sonarqube 
brew install sonar-scanner

After installation of the sonarqube you need to start the services. Please enter the command brew services start sonarqube in the terminal. You can create your credentials by hitting this URL: http://localhost:9000/

Update your sonar project setting on build.gradle:

  sonarqube {
      properties {
          property "sonar.projectVersion", "1.0"
          property "sonar.projectName", "your app name in sonar"
          property "sonar.projectKey", "your app name in sonar"
          property "sonar.host.url", "http://localhost:9000/" // or https://sonarcloud.io/
          property "sonar.login", "xxxxxxxxxxxxxxx" //Generated in sonarqube
          property "sonar.language", "kotlin"
          property "sonar.sources","src/main/java"
          property "sonar.java.coveragePlugin", "jacoco"
          property "sonar.coverage.jacoco.xmlReportPaths", "${rootProject.projectDir}/app/build/reports/jacoco/debug/jacoco.xml"
      }
  }

Again in the Android Studio, hit this command in terminal

./gradlew sonarqube

Dependencies

Below you will find the libraries used to build the template and according to my criteria the most used in android development so far.

References

About

Android app using guide to architecture.

Resources

Stars

Watchers

Forks

Languages