Mobile software development begins with the creation of a project, and the first thing the user sees is the name displayed under the icon on the desktop. Often, novice developers are faced with the need to change this value after the project has been initialized, when a standard name like โMy Applicationโ no longer corresponds to the product concept. In the environment Android Studio this process is not limited to simply renaming the file, since the application name is tightly bound to the resources and build configuration.
Incorrectly changing the name can lead to compilation errors or the display of old data on the emulator, which is confusing when debugging. Understanding the project structure Android allows you to avoid common mistakes associated with caching resources or desynchronization of manifest files. In this article, we'll take a closer look at where exactly your app's metadata is stored and how to safely make changes.
It's worth noting right away that there is a difference between the package name and the visible app name, and they should not be confused. If you want to change how a project appears in the list of installed apps on a device, you need to work with resources, not Java class identifiers. Let's look at the step-by-step algorithm for successful renaming.
Difference between Package Name and App Name
Before making changes to the code, you need to clearly understand the architectural differences between the internal identifier and the custom name. Package Name (package name) is a unique identifier for your application in the Google Play Android operating system, which looks like a domain name in reverse, for example com.example.myapp. This name is used by the system to distinguish applications, store data and updates, and changing it after publication in the store is almost impossible without creating a new application.
Unlike the technical identifier, App Name (application name) is a text string that is displayed to the user under the icon on the smartphone screen. It is this value that we will change, and it is stored in resource files, which makes it easy to localize the application into different languages. Confusion between these concepts often leads to developers trying to rename source code folders, breaking the structure of the project, when they just needed to fix the text file.
Changing the package name requires refactoring all imports and paths in the code, which is a time-consuming and risky process for the finished project. At the same time, changing the displayed name takes a few seconds and does not affect the logic of the app. Therefore, always check what specific problem you are solving: technical identification or user interface.
โ ๏ธ Attention: Changing the package name in an already published application is equivalent to creating a new product. All installations, ratings and user data will be lost if you try to download such an APK file as an update.
Use reverse domain notation (for example, com.company.project) for the package name to ensure it is globally unique in the Android ecosystem.
Changing the name via the strings.xml file
The main and most correct way to change what the application is called for the user is to edit the resource file strings.xml. This file is located at path app > res > values > strings.xml and contains all the text constants used in the interface. In a standard project configuration, the application name is bound to a resource named app_name, whose default value is often the same as the name of the project when created.
Opening the file strings.xml, you will see an XML structure where each text element has its own tag. You need to find the line Old Name and replace the text between the tags with the desired name. After saving the file (Ctrl+S or Cmd+S), the development environment will automatically rebuild the resources, and the next time you launch it on an emulator or device you will see the updated name.
Using a resource file instead of hardcode names in the manifest makes it easy to support multilingualism. You can create additional directories, such as values-es for Spanish or values-fr for French, and in each of them specify a different value for app_name. The Android system itself will select the correct file depending on the language settings of the user's device.
โ๏ธ Checking changes in strings.xml
Setting the name in AndroidManifest.xml
Although the main storage of text is the resource file, the entry point to the application - the manifest - is also must correctly reference this name. The file AndroidManifest.xml is located in the directory app > manifests and contains critical configuration. The attribute android:label in the tag <application> determines what name will be displayed in the system, and in the right project it should contain a link to the resource, and not a hardcoded string.
Make sure that the line android:label="@string/app_name" uses a link to the resource. If there is direct text, for example android:label="My App", replace it with a link @string/app_name. This will ensure synchronization: when you change the text in strings.xml, it will be automatically updated both in the manifest and in all other places where this resource is used.
In some cases, for example, when creating Shortcuts or widgets, individual attributes can be used label. The principle remains the same: it is always preferable to use resource links (@string/...) to centrally manage the text. This simplifies code support and eliminates situations where the application is called differently in different parts of the system.
| Attribute | Location | Value | Influence |
|---|---|---|---|
| android:label | AndroidManifest.xml | @string/app_name | Basic name in launcher |
| app_name | res/values/strings.xml | Text string | Stores the title text |
| applicationId | build.gradle | com.example.app | Unique package ID |
| android:label | Activity Manifest | @string/activity_name | Name of a specific activity |
If you use Product Flavors (options builds) to create different versions of the application (for example, Free and Pro), you can specify different names for each version. This is done through the configuration in build.gradle, where for each flavor its own applicationId is specified and resources can be overridden, including app_name. This approach allows you to support multiple versions of the same code on the same device without conflicts.
How to rename an activity?
If you want to change the name displayed in the title of a particular Activity, find its declaration in AndroidManifest.xml and check the android:label attribute. If it is not set, the activity inherits the common name of the application.
Renaming package and project directories
If your task is to change the project structure and package name (for example, when starting a new project with a temporary name), the process will be more complex. Android Studio has a built-in refactoring tool that helps you safely rename packages. To do this, go to the project view Android (Project tab on the left), find the folder with the source code java or kotlin and right-click on the package.
Select menu Refactor > Rename (or use hotkeys Shift+F6). In the window that appears, enter a new name. It is important to select the Rename packageoption and not Rename directoryto have the IDE update all references in the code, manifest and Gradle files. If you simply rename the folder in the file manager, the project will no longer compile due to a mismatch between the paths and the declared package.
After renaming the package, you need to check the file build.gradle (Module: app). In the block defaultConfig parameter applicationId must match the new package name if you change it for publication. It's also worth checking the file local.properties or configuration files if they had old paths hardcoded.
โ ๏ธ Warning: When renaming a package, make sure that classes with path-dependent annotations (for example, some navigation components or DI frameworks like Dagger/Hilt) are updated correctly. In rare cases, manual editing of configuration files is required.
Changing the name via Gradle (Build Variants)
Modern development in Android Studio is unthinkable without an assembly system Gradlethat allows flexible configuration management. If you need the application name to change automatically depending on the build type (Debug or Release) or the selected flavor (Flavor), use the mechanism resValue. This allows you to set resource values โโdirectly in the file build.gradle.
Inside a block android { defaultConfig { ... } } or inside a specific one flavor add the line: resValue "string", "app_name", "\"New Name\"". Note the double quotes around the string value - this is a Gradle syntax requirement for string literals. With this setting, the value in strings.xml will be overwritten by the value from Gradle at build time.
This method is especially useful for adding prefixes like "[DEBUG]" to the app name in the debug version to distinguish it from the production version on the tester's device. You can create a flavor debugVersion and give it the name "MyApp Debug", and for release leave it just "MyApp".
android {flavorDimensions "version"
productFlavors {
full {
dimension "version"
applicationIdSuffix ".full"
resValue "string", "app_name", "\"My App Full\""
}
demo {
dimension "version"
applicationIdSuffix ".demo"
resValue "string", "app_name", "\"My App Demo\""
}
}
}
Using resValue in Gradle allows you to dynamically change the name of the application for different builds without manually editing XML files.
Clearing the cache and rebuilding the project
After making changes to resources or configuration, a situation often arises when the emulator or device continues to display the old name. This happens due to Android's resource caching mechanism and the IDE itself. To ensure that all changes are applied, you must perform a complete rebuild of the project, and not just Run.
In the top menu of Android Studio, select Build > Clean Project, wait for the process to complete, and then select Build > Rebuild Project. This action will remove all temporary compilation files and regenerate the assets, incorporating your changes into the APK file. If this does not help, try deleting the application from the device manually and launching it again through the IDE.
It is also worth checking the settings of the emulator itself or the physical device. Sometimes smartphone launchers (shells) cache icons and names. In such cases, a long tap on the icon -> "About the application" -> "Storage" -> "Clear cache", or simply restarting the device helps.
- ๐ Run
Build > Clean Projectto remove old artifacts. - ๐จ Run
Build > Rebuild Projectto completely regenerate the code. - ๐ฑ Delete the application from the test device before launching it again.
- ๐๏ธ If necessary, clear the cache of the Android emulator itself.
Why does the name not change after all the actions?
If the name does not change, check whether it is redefined in the file AndroidManifest.xml inside the specific <activity>. Also make sure that you are not looking at the shortcut that was created earlier, but have installed the latest version. In rare cases, the command Invalidate Caches / Restart in the File menu helps.
Is it possible to change the name of an already published application?
Yes, the displayed name (App Name) can be changed as many times as you like through the Google Play Console. This does not require any code changes if you are using resources. However, you cannot change the Package Name (ID) after publication - it will be a new application.
How to change the name for different languages?
Create resource folders for each language, for example values-ru, values-en. In each of them, create or edit a file strings.xml, specifying the translation for the tag app_name. The system itself will substitute the required language.
To summarize, changing the name of an application in Android Studio is a straightforward process if you understand the difference between resources and configuration. By working with the file strings.xml and correctly setting up the manifest, you can easily adapt the project to any branding requirements. The main thing is not to forget about rebuilding the project and checking different assembly configurations.