Android
Package Naming
Naming Convention
Development Best Practices
Android Guidelines

Android - Package Name convention

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Android package naming is mainly about uniqueness, readability, and long-term stability. The traditional convention is reverse-domain notation such as com.example.myapp, but modern Android projects also need you to think clearly about the difference between Java or Kotlin package names, the Gradle namespace, and the app’s applicationId.

The Traditional Convention

The classic Android package naming style uses reverse-domain notation:

text
com.companyname.appname

This works well because domain ownership naturally helps keep names unique. The convention also tends to be lowercase, dot-separated, and stable over time.

Good examples:

  • 'com.example.notes'
  • 'io.acme.reader'
  • 'org.mycompany.inventory'

Why Stability Matters

The package or app identifier is not just cosmetic. It affects:

  • app installation identity
  • Play Store updates
  • deep links and permissions
  • code organization and refactoring effort

Once an app is published, changing the installed application identity is far more expensive than choosing a good one early.

applicationId vs Package or Namespace

Modern Android builds separate concepts that older tutorials often blur together.

  • 'applicationId is the install identity used by the device and Play Store.'
  • 'namespace is the code-generation and resource namespace used by the Android Gradle Plugin.'
  • source-code package declarations are the language-level package paths in your Kotlin or Java files.

A simple Gradle example looks like this:

gradle
1android {
2    namespace "com.example.notes"
3    defaultConfig {
4        applicationId "com.example.notes"
5    }
6}

They are often the same, but they do not have to remain identical in every advanced setup.

Naming Rules That Keep Life Easy

In practice, good Android package names are usually:

  • all lowercase
  • made of letters, digits, and dots
  • descriptive but not overly long
  • based on something your team controls

Avoid cute names that mean nothing to another developer six months later. Clear, boring names age well.

Build Variants and Suffixes

During development, different build types often use suffixes so they can be installed side by side.

gradle
1buildTypes {
2    debug {
3        applicationIdSuffix ".debug"
4    }
5}

That lets a debug build install next to the release build instead of colliding with it.

What Not to Do

Avoid naming decisions that create future pain:

  • changing the published application ID casually
  • using uppercase letters or odd separators
  • coupling the name too tightly to a temporary product codename
  • choosing a domain-based prefix you do not control

These are not just style issues. They affect maintainability and update behavior.

A Practical Rule of Thumb

Pick a reverse-domain identifier based on a domain or organization you control, keep it lowercase, and choose an app segment that will still make sense after the app grows. If you later need separate build variants, use suffixes instead of changing the core identity.

Common Pitfalls

  • Treating package naming as cosmetic ignores its role in installation and updates.
  • Confusing namespace with applicationId leads to Gradle and publishing confusion.
  • Renaming a published app identifier is much harder than refactoring source packages.
  • Using unstable product names in identifiers creates long-term mismatch between code and product reality.
  • Forgetting debug suffixes can cause install collisions during development.

Summary

  • The standard Android convention is lowercase reverse-domain notation such as com.example.myapp.
  • Stable naming matters because app identity affects installation and updates.
  • Modern Android distinguishes between code namespace and applicationId.
  • Use suffixes for debug or variant builds instead of changing the core app identity.
  • Choose a clear, controlled, long-lived identifier early.

Course illustration
Course illustration

All Rights Reserved.