While building your app into the an application package (APK), the build system uses the package attribute for two things:

It applies this name as the namespace for your app's generated R.java class (used to access your app resources). For example, if package is set to "com.example.myapp" , the R class is created at com.example.myapp.R .

class (used to access your app resources). It uses this name to resolve any relative class names that are declared in the manifest file. For example, if package is set to "com.example.myapp" , an activity declared as <activity android:name=".MainActivity"> is resolved to be com.example.myapp.MainActivity .

This name is also the default name for your app process (see the <application> element's process attribute). And it's the default task affinity for your activities (see the <activity> element's taskAffinity attribute).

This name also represents the application ID, which must be universally unique in order to publish your app in Google Play. However, toward the end of the APK build process, the build tools override the package name using the applicationId property from the build.gradle file (used by Android Studio projects). As long as you keep the manifest's package name the same as the build file's applicationId , this won't be a concern. But if these two values differ, you should understand the differences between the "package name" and "application ID" by reading how to set the application ID.

To avoid conflicts with other developers, you should use Internet domain ownership as the basis for your package names (in reverse). For example, apps published by Google start with com.google .

Note: Both the com.example and com.android namespaces are forbidden by Google Play.