Android Standard 2022

Android Code Standard 2022


  • Architecture
    • Design Pattern
    • Foldering/packaging
    • Compose Architecture
  • Code style and features
  • Documentation
  • Security
  • Best Practice
  • Naming Composable Widget & Resources
  • Third party libraries


  • Core Library
  • Modular
    • Project Features splited by module/library as possible
    • Core module to support other module/project
  • Architecture Components Android Jetpack
  • Design Pattern MVVM

Core Library

  • Network/ Connection configurations
  • Base -> ViewModel, Activity, Fragment, Adapter, WebView, etc
  • Utils & Extentions
  • Widgets
  • Analytics Repository (for log event)
  • In app updates function

Please check Core Library Repo for detail of how to use core library.

Modular Project

Diagram modular Image
Diagram modular Image
  • app : main module project

  • module-1..module-N : module of features. To define module of feature, create a group of features. For example if we have a project like Gojek may the module are like below.

    Module NameDescription
    authModule for authentication. In here there are login, register, forgot password
    go-foodModule for GoFood. There are near me, voucher/ promo (go-food), history, etc.
    go-sendModule for GoSend. There are within city, intercity and voucher
  • common : is a module to support other modules that have common used classes in project following their own contract/business model.

  • core : core library.


Structure of foldering/packaging in module are like this

app (module name)
│─── di
│  │   ...
│─── model
│  │   NotifRequestModel
│  │   NotifResponseModel
│─── repository
│  │   ...
│─── service
│  │   ...
│─── ui
│  │   main
│  │  │   MainViewModel
│  │  │   MainScreen
│  │  │   MainContent
│  │   notif
│  │  │   ...
│─── util
│  │   ...
diIs a subpackage for dependency injection
modelIs a subpackage for class models
repositoryIs a subpackage for api or local repository, that have function to help view model retrive data
serviceIs a subpackage for all background related service packages/classes
uiIs a subpackage for all UI-related packages/classes including their own view model class
utilFor used global helper functions in module

Compose Architecture

Diagram modular Image
Architecture with Compose

Code Style, Features



  • Deeplink
  • Analytics


  • K-Doc format, and use dokka engine documentation
  • Format Markdown


  • Proguard
  • SSL Pinning
  • Integrate Keystore
  • Env variable value (cred data : Global Properties)
  • Root (firebase)

Best Practice

  • Single-Activity arch
  • Use Navigation Component
  • Using kotlin with reactive programming
  • Min SDK 21
  • Using Dependency Injection
  • Assets svg
  • Core GraphQL (replacing webservice)
  • Core Webservice
  • Theme & Styling
  • Tablet Version
    • Separated apk mobile and tablet
    • Same core business logic
    • Same repository (splited by branch)
    • Only different on layout
  • Jetpack Compose
    • All of @Composable components should be able to use @Preview (use initial/mock data and no error when preview the widget)
    • State with ViewModel.
    • Place the state at StateHolder (use State Hoisting way).
    • Create reusable widget as possible (prevent redundant code).
  • Setup Android CI/CD

Don’t do it

  • Don’t use beta/ alpha library version
  • Don’t use Kotlin synthetics (not longer supported), use view binding instead
  • To handle nullable don’t use !!, using lateinit, ?., ?: or ?.let{ /do something/ } instead

Naming Composable Widget Function

Most commonly used naming Android Composable function following format NameAbbrevation like below.

ObjectiveAbbrevationNaming Sample
Library Screen (State Holder)ScreenLibraryScreen
Library ContentContentLibraryContent

Naming Resource


We use _ for strings naming. is Button,Dialog,Divider,Icon, etc & description give any extra information.

Drawable names Image
Drawable names Image


String names start with a prefix that identifies the section they belong to. We use <HOW>_<DESCRIPTION> for strings naming. <HOW> to indicate reason of the string will be used & description give any extra information.

For ex:

String names Image
String names Image
  • <string name="label_update_app_now">Update aplikasi sekarang!</string> : how = label & update_app_now is description of the string.
  • <string name="hint_user_name">Masukkan Username : how = hint & user_name is the description of string.

Third party libraries

  • Jetpack Components
  • navigation, paging, camera, fragment, livedata, room, etc
  • Async : Coroutines
  • Dependency Injection : Dagger2/ Koin
  • Network/ Connection : Retrofit
  • Unit Testing : JUnit + Mockito
  • Load Image : Glide
  • Others : From google first than commons used