IntelliJ IDEA 14.0.0 Web Help

Renaming an Application Package (Application ID)

You may need to have your application built in several versions, which means that several Android application packages (.apk files) will be generated. If these files have the same name, the user will be unable to deploy them on the same device simultaneously. To avoid this, you can have IntelliJ IDEA generate several .apk files with different names (application IDs) from the same source code.

The application package name (application ID) is specified in the package attribute of the manifest element (see for details). This name follows the Java naming conventions and, by default, is the same as the name of the package to which the class implemented for the application belongs.

The name of the application (the android:name attribute of the application element, see and activity names (the android:name attribute of the activity element, see are, by default, specified relative to the application ID and, accordingly, to the parent Java package of the application implementation class. However, renaming the application ID does not cause renaming the parent Java package of the application class.

You can either change the application ID through the Rename refactoring, or automatically on build time.

On this page:

Changing an application ID through the Rename refactoring

  1. Open the AndroidManifest.xml file.
  2. Position the cursor at the package attribute of the manifest element and choose Refactor | Rename from the context menu.
  3. In the Rename dialog box that opens, specify the new package name and click OK.

Renaming an application ID on build time

  1. Open the Project Structure dialog box by choosing File | Project Structure from the main menu.
  2. Select Modules in the left pane. In the central pane, expand the node of the relevant module and click Android.
  3. In the right pane, switch to the Packaging tab and select the Rename manifest package option.

See Also

Last modified: 4 December 2014
comments powered by Disqus