This is a simple example for Application name and package rename. Have you find your self in a situation when creating an Application, in the middle of the development or later, there is a change name request? Or you wanted your app to be renamed? Below is an explanation how to do that.
First, open new or existing Android studio project. After loading, locate your root app folder. In this example the root app folder path is app/src/java/com/denofdevelopers/changeappnameandpackage. In your case the path will be app/src/java/<your domain>/<your app name> OR app/src/java/<your app name>. In this example the domain is ../com/denofdevelopers/… and the app name is changeappnameandpackage.
The app name (by default) is located in strings.xml resource file under app_name. In this example that resource string is:
And this is shown as your application name under the app icon on the phone:
1. Change name of the Application
Changing the name of the application, does not change the application it self. It is not different application. Just its name it is changed. To do this, we need to go to our strings.xml file and simply add name that we want. The name will be displayed under the application icon on our phone and we are done.
<string name="app_name">App Name Changed</string>
2 Change package of Application
Changing the package of the application does not change the application itself. The changing of app package is made by right clicking on app package, in our case changenameandpackage -> refactor -> rename and you’ll have this warning message:
Click on rename package and do actual rename.
In our case the package is renamed to – newapppackage:
3. Change ID of the Application (Name and Package also)
Changing the id of the application does change the application itself. It is a completely. ID of the package is unique identifier of the app, distinguishing from other apps. The changing of app ID is made by changing the applicationId in app build.gradle file:
apply plugin: 'com.android.application'
applicationId "com.denofdevelopers.changeappnameandpackage" // <-- change this in to newapppackage
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
implementation fileTree(dir: 'libs', include: ['*.jar'])
This application ID is determined by your app package. The old one is com.denofdevelopers.changeappnameandpackage and we will change to com.denofdevelopers.newapppackage, so we will have completely new application. Click on sync project and wait for the syncing to finish. The result is this:
This is same app with same source code, but different name, package and app ID