Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change Android App Name and ID of an existing application?

I have two Android projects in Eclipse. I copied the one project from the other, then changed the app name (in strings.xml) and the project name (in Eclipse).

But now there is a problem: When I run either of the applications in the emulator, the other one gets lost (maybe overwritten?). So I guess that there is another setting I have to make, so that Android recognizes the two apps to be different?

Thanks!

like image 835
VKurt Avatar asked Jul 03 '11 16:07

VKurt


People also ask

Can you change the name of an app on Android?

When you install an app on an Android device, a shortcut for the app is created with a default name and added to your home screen. The Android system does not allow you to change the name of your shortcuts.

Can we change app name dynamically in Android?

It's not possible by the moment. It is a fixed string in the AndroidManifest. xml file which cannot be changed at runtime.


3 Answers

Actually you need to change the name in several places:

First, as you said, the name of the string, which is the visible name of the application.

Second, go to activity->src and right click on the package (com.example.whatever) and do refactor->rename;

Then go to the manifest.xml: and change the field in:

<manifest package="com.example.whatever" >

If you are using native code, JNI, you will also have to change the names of the c++ functions, which is a pain in the ass:

Java_com_example_whatever_activity_function()
like image 93
Jav_Rock Avatar answered Oct 10 '22 05:10

Jav_Rock


For those who aren't using Android Studio and want to do it manually (e.g. if you're using React Native), I just recently went through this and had to change it in the following files:

index.android.js
android/settings.gradle
android/app/build.gradle
android/app/src/main/AndroidManifest.xml
android/app/src/main/java/com/<app id>/MainActivity.java
android/app/src/main/java/com/<app id>/MainApplication.java
like image 23
Pedram Avatar answered Oct 10 '22 06:10

Pedram


Package name (in java).

The app name is also in the manifest, although I don't think that needs to be unique, but still would be good to change it for clarity.

like image 13
Nanne Avatar answered Oct 10 '22 05:10

Nanne