Android Standard

Android Code Standard 2021


  • Architecture
    • Design Pattern
    • Foldering/packaging
  • Code style and features
  • Documentation
  • Security
  • Naming class ui (widget) & resources
  • Third party libraries


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

Inside Core Library

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

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
│  │  │   MainFragment
│  │  │   MainActivity
│  │   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

Code Style, Features


Documentation Code

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


  • Deeplink
  • Analytics


  • 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

Don’t do it

  • Don’t use beta/ alpha library version (ex: compose)
  • 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 UI View

Most commonly used naming Android UI View classes following format abbrevation_name like below.

View ClassAbbrevationNaming Sample

Naming Resource


Recommendation of layout names are like this.

Drawable names Image
Drawable names Image


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.

3rd 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