Wednesday, June 24, 2015

How to change Package name of Android App?

Sometimes an Android project needs to be renamed. Maybe a file was copied manually into the project . Maybe the application name has changed during development, and it needs to be reflected in the filesystem tree. Automatic tools help with this and ensure cross-references are automatically updated. For example, in the Eclipse IDE, the different ways to rename portions of an application are
  • Rename the Android project, as follows:
    1. Right-click the project and Refactor u2192.jpg Move to a new directory in the filesystem.
    2. Right-click the project and Refactor u2192.jpg Rename the project.
  • Rename an Android package, as follows:
    1. Right-click the package and Refactor u2192.jpg Rename the package.
    2. Edit the AndroidManifest.xml to ensure the new package name is reflected.
  • Rename an Android class (such as the major components ActivityServiceBroadcastReceiverContentProvider), as follows:
    1. Right-click the .java file and Refactor u2192.jpg Rename the class.
    2. Edit the AndroidManifest.xml to ensure the android:name has the new component name.