Mobile software development often requires making changes at the prototyping stage, when the draft name of the project no longer matches the concept or marketing strategy. In a development environment Android Studio changing the display name is not just renaming a file, but a complex process that affects configuration files and project resources. Failure to do this correctly may result in the user's device displaying a technical identifier instead of a clear brand name.

The process of changing the name depends on which entity you want to modify: the name visible to the user on the desktop, or the internal system name of the package. It is important to understand the difference between these concepts, since they are stored in different parts of the project structure. In this article, we will analyze in detail all aspects of renaming, from editing the manifest to setting up build systems.

For beginners, this task may seem confusing due to the abundance of settings in the IDE, but sequential execution of the steps guarantees the correct result. We'll cover both manual file editing and the use of built-in refactoring tools that make a developer's life much easier. Be prepared to touch several key configuration files.

Differences between package name and display name

Before making changes to the code, it is necessary to clearly distinguish between two fundamental concepts in the ecosystem Android. The first is Application ID (application identifier), which is the unique address of your product in the system and application stores, for example com.example.myapp. The second is App Name (application name), the same text that the user sees under the icon on the main screen of his smartphone.

Change Application ID is a serious operation that actually creates a new application from the point of view of the operating system. If you change this identifier, the system will consider your updated software to be a completely different app, unrelated to the previous version. This means the loss of all user data, settings and the ability to update โ€œon topโ€ of the old version through the store.

At the same time, changing the display name is a cosmetic edit that does not affect the internal logic of the package or the identification of the package. You can change it as many times as you like during development without any negative consequences to the database or authorization. It is this aspect that we will consider first, since it is most in demand in the early stages.

โš ๏ธ Attention: Never change applicationId in the file build.gradle for an application already released on Google Play, unless you plan to create a completely new project from scratch. This will break the connection with the existing user base.

Understanding this architecture is critical to avoiding fatal errors during deployment. Many novice developers confuse these entities, trying to rename a package where only the resource string needs to be changed. Let's now move on to the practical implementation of changing the visible name.

๐Ÿ“Š What do you want to change first?
Display name (on screen)
Package ID (technical name)
APK file name
Nothing, I'm just reading

Changing the display name through strings.xml resources

The most correct and professional way to change the name of your product is by editing the resource file. In the Android project structure, all text lines that the user sees are placed in a separate file res/values/strings.xml. This is done for ease of localization, but also allows you to centrally manage names.

Open the file strings.xml in the project window. Find the line named app_name. By default, it appears as a resource containing the current name of your project. It is the value of the attribute name inside the tag string that is responsible for what will be written under the icon.

<resources>

My New Application

</resources>

Replace the text inside the tag with the desired name. After saving the file (Ctrl+S or Cmd+S), you need to rebuild the project for the changes to apply. Click the Run or Build Bundle(s) / APK(s)button to compile the new version. On an emulator or physical device, you will immediately see the updated title.

Using a resource file is a best practice as it allows you to easily create different titles for different languages. If you simply hardcode the name in the manifest, you will have to edit it manually when adding support for other locales, which is inefficient and prone to errors.

๐Ÿ’ก

Use short and concise names in resources, since on some smartphone screens long application names can be cut off by ellipses. The optimal length is up to 12-15 characters.

Direct editing of AndroidManifest.xml

Although working with resources is preferable, sometimes there is a need to understand how the name is tied to the manifest. The file AndroidManifest.xml is a passport of your application, where_declared_ are all its components. The attribute android:label in the tag application refers to the string resource that we changed in the previous section.

By default, you will see a link like this @string/app_name. This means that the system takes the value from the resource file. However, technically you can write the name right here, although it is not recommended by experts. A direct entry looks like this:

<application

android:allowBackup="true"

android:icon="@mipmap/ic_launcher"

android:label="Direct Application Name"

android:theme="@style/AppTheme">

This approach deprives you of flexibility. If you decide to release the application to the international market, you will have to create different versions of the manifest or manually edit the code for each language. Linking through resources allows the system to automatically substitute the desired name depending on the language settings of the user's device.

Also in the manifest you can set different names for individual activities (screens) that are displayed in the recent applications menu. This is done through the attribute android:label in the tag activity. Unless otherwise specified, the activity inherits the application's common name from the root tag.

โš ๏ธ Warning: When manually editing AndroidManifest.xml be extremely careful with XML syntax. An extra space or an unclosed tag will result in a compilation error, and the project will not run.

Checking the correctness of the manifest is carried out automatically by the environment Android Studio, which highlights errors in red. Always trust these hints and do not ignore the linter's warnings, especially when it comes to key configuration files.

Changing the package name (Application ID) and refactoring

If your goal is to change not just the โ€œsignโ€, but the technical name of the project, then you will need a refactoring procedure. This is a more complex process involving directory structure and build configuration. You should start by changing Application ID in the file build.gradle (app module level).

Find the block defaultConfig and change the value applicationId. For example, from com.example.oldname to com.example.newname. However, this is only part of the job. To ensure that the physical code folders match the new name, you need to use the IDE's refactoring tool.

In the project window, switch the view to Project (instead of Android). Expand the directory tree to level java or kotlin. Right-click on the folder with the current package name (for example, oldname) and select Refactor -> Rename. Enter a new name and confirm the action.

  • ๐Ÿ“‚ Folder structure: Refactoring will automatically rename the directories, preserving the nesting of classes.
  • ๐Ÿ”— Updating imports: All imports in code files will be updated automatically, saving hours of manual work.
  • โš™๏ธ Configuration: Don't forget to check the settings in build.gradleso that they match the new structure.

After completing the refactoring, be sure to run the command Clean Projectand then Rebuild Project. This will remove the old compiled files and create new ones based on the changed paths. Ignoring this step can lead to strange runtime errors when the system cannot find classes at old addresses.

โ˜‘๏ธ Checklist for changing the package

Done: 0 / 4

Setting names for various assemblies (Build Variants)

In professional development, several versions of one application are often used: free, paid (Paid), version for debugging (Debug) and release (Release). Android Studio allows you to set unique names for each build option using the mechanism product flavors or resource configuration.

To implement this approach, different resource folders are created. For example, you can create a directory src/free/res/values/strings.xml i src/paid/res/values/strings.xml. In each of these files you define a line app_name with different content.

Build type Path to resources App_name value Icon
Debug src/debug/res/ MyApp (Debug) Gray icon
Release src/release/res/ MyApp Colored icon
Free Flavor src/free/res/ MyApp Lite Icon with the inscription Free
Paid Flavor src/paid/res/ MyApp Pro Golden icon

When you switch the build option in the panel Build Variants, Android Studio automatically pulls resources from the corresponding folder. This allows you to have "Lite" and "Pro" versions installed on the same device with different names and icons, without creating package conflicts, if applicationIdSuffix is configured correctly.

This approach is extremely useful for testing. You can clearly see which version of the application is currently running just by looking at the name. This prevents accidental sending of a debug version to production.

โš ๏ธ Attention: The interface and customization options Build Variants may vary slightly in different versions Android Studio. Always check the official documentation for your version of IDE if you do not find the usual menus.

Changing the name of the APK and AAB file when exporting

In addition to the name within the system, developers are often interested in the name of the installer file itself, which is generated during the build. By default, Gradle generates file names based on the build configuration, which may look like app-debug.apk or app-release.aab.

To make the file name more presentable, for example SuperGame_v1.0.apk, you need to configure the build script in build.gradle. For this, a block is used android.applicationVariants.all, where you can programmatically set the output file name template.

android.applicationVariants.all { variant ->

variant.outputs.each { output ->

def appName ="SuperGame"

def versionCode = variant.versionCode

def versionName = variant.versionName

def buildType = variant.buildType.name

def newApkName ="${appName}-v${versionName}-${buildType}.apk"

output.outputFileName = newApkName

}

}

This script will automatically rename all generated APK files in accordance with the specified template. This is especially convenient when automating CI/CD processes, when files are uploaded to the server or sent to testers, and it is important to immediately understand the contents of the archive by its name.

It is worth noting that for the format AAB (Android App Bundle), which is now required for publishing on Google Play, renaming works the same way, but the file extension will be .aab. It is important to ensure that the file name does not contain prohibited characters that can cause errors in the servers' file systems.

Why is the file name important?

The file name affects the ease of sorting and finding the installer in the user's downloads folder. A clear name increases confidence in the file before installation.

Common errors and ways to resolve them

The renaming process, despite its apparent simplicity, is often accompanied by caching errors. Android Studio aggressively caches paths and resources to speed up work. If you changed the name, but the old one remains on the emulator, most likely the problem is in the cache.

First of all, try executing the command Invalidate Caches / Restart from the menu File. This will force the IDE to rebuild all indexes from scratch. In 90% of cases, this solves problems with โ€œghostโ€ names or broken links to resources after refactoring.

Another common problem is desynchronization between build.gradle and real folders. If you renamed the folder manually in Explorer rather than through the IDE refactoring, the build system will lose track of the source code. Always use tools Android Studio to move and rename files.

  • ๐Ÿงน Cleanup: Do this regularly Clean Project before final assembly.
  • ๐Ÿ”„ Synchronization: Press Sync Now after any edits in Gradle files.
  • ๐Ÿ“ฑ Deletion: When changing the Application ID, remove the old application from the device before installing a new one.

It is also worth mentioning the problem with icon. Often, when changing the name, developers forget to update the icon, which creates dissonance. Make sure that your folders mipmap have up-to-date images that match the new branding of your product.

๐Ÿ’ก

The main rule: Any changes to the project structure or package names should be carried out only through the built-in refactoring tools of the IDE, and not through renaming files in Explorer.

Is it possible to change the name of the application after publishing it on Google Play?

Yes, the display name can be changed at any time through the Google Play Developer Console. However, you cannot change package name (Application ID) after publication - to do this you will have to create a new application with a new listing.

Why does the application crash on startup after renaming?

Most likely, you changed the package name, but did not update the paths in the manifest or imports in the code. Either you did not remove the old version of the application from the device, and there was a conflict of signatures or identifiers.

How to change the name that appears in the list of recent applications?

To do this, you need to change the attribute android:label in a specific tag activity in the file AndroidManifest.xml. If the attribute is not specified, the app's generic name is used.

Does changing the app name affect its position in ASO search?

Yes, the app name is one of the key ranking factors in app stores. Changing the name may temporarily affect visibility, so the new keywords in the title must be relevant.

Does the name in the build.gradle file need to be changed when changing the name on the screen?

No, in build.gradle only the technical applicationIdchanges. The name on the screen is stored in resources (strings.xml) and does not require editing the assembly files, unless you configure different names for different versions (flavors).