Saturday, June 4, 2016

Renaming Android Studio Project and Main Package

Content of this blog post has been tested with Android Studio 2.0.

Changing Project Name
  • Open Project Window (View → Tool Windows → Project or Alt + 1)
  • By default Project window shows the Android view change it to Project view with the drop down menu at top left. 


  •  Right click on project root → Show in Explorer.
  • Close Android Studio.
  • Go into project folder.
  • Change .iml file to new name that you want to have for the project.
  •  Change the project folder name to new name which is same name of .iml file.
  • Start Android Studio
  • Click on “Open an existing Android Studio project”
  • Find & select the renamed project, then “Ok”
Changing Package name
  • Right Click on package name (I tried this on main package)
  • Refactor
  • Rename
  • Rename Package
  • Type new name & click Refactor
  • Click on Do Refactor 
After doing this I have observed changing the main package name successfully renamed other two packages (androidTest & Test) during refactoring process. Although Generated files like AndroidManifest.xml also had correct values strings.xml file had old project name for the string element with attribute “app_name”.
Above experiment was done on a very small project.


No comments:

Post a Comment