How to change the name of a project's root directory in Android Studio 0.9.9. I read the other solution here but nothing works for me. I can change/refactor the package name but not the name of the root directory. I found another solution here, which is to change the name in .idea/.name
file, which didn't work. After I changed name, I tried cleaning, rebuilding etc. but nothing reflected the changes in Android Studio. There is no REFACTOR option for "PROJECT NAME / ROOT DIRECTORY NAME", many people here confused the module name with project name / root directory name.
-
5If you are asking about just the root directory of the project, close Android Studio, rename the file in your PC and import that directory again as a project. – k1slay Feb 17 '15 at 18:49
-
Thnk u , actually I did this before n it worked but I thought maybe there is a solution from within android studio itself,like refactoring which ll automate the process. Thnx by the way – Tanvir Feb 18 '15 at 07:43
-
I found that even after importing as non android project, the project code sometimes breaks. It works sometimes, not always. – Tanvir Feb 18 '15 at 08:35
11 Answers
Basically you can by changing the project's folder name and reopening it.
It is also recommended to change the name of the project in the Android Studio project structure by editing these files:
- Change the project name in
.idea/.name
- Rename the
[Name].iml
file in the project root directory - Change the reference to this iml file in
.idea\modules.xml
- Change the
rootProject.name
in the project rootsettings.gradle
-
When u do as stated above u dont need to change any file. The import deos it all. Actually I did this before n it worked but I thought maybe there is a solution from within android studio itself,like refactoring which ll automate the process. Thnx by the way – Tanvir Feb 18 '15 at 07:44
-
2I found an android studio way of doing it,I mean full automation of the directory name edition process. Change view to Project in project explorer. Select the root directory/project name, then go to Refactor>Copy , Change the name of the project here,in the resulting project,it will reflect this change.but this is kinda weird bcos another copy will be created with new name. – Tanvir Feb 18 '15 at 08:01
-
However, this does not change the top level directory - close the Android Studio, rename the directory, open it again by browsing it and you are done! – mrek May 10 '16 at 20:58
-
2Also, if this wasn't done so already: make sure to open up the `settings.gradle` file within the root module and then rename the project path within the `include` function to your new app module's name. That way, Gradle will build and then set the respective configurations to actually build the app – DaveNOTDavid Sep 24 '18 at 12:27
Close android studio
Change project root directory name
Open android studio
Open the project(not from local history but by browsing to it)
Worked for me @ Studio 2.1.3

- 2,940
- 1
- 25
- 38

- 577
- 5
- 7
-
2Worked for me, but I also had to run **Build > Clean Project** to [prevent "Installation failed with message Invalid File" error](https://stackoverflow.com/a/42760961/4084269) when running the app after renaming. – Josselin Nov 29 '17 at 11:54
-
I followed the steps and got the invalid file error, doing what Josselin said worked for me. – stramin Mar 28 '19 at 14:34
File->Close project
Change project root directory name
Delete .iml files (by searching for them using windows search then deleting them)
Delete .idea directory
Open the project

- 15,003
- 4
- 45
- 54
-
1Clean and rebuilt application. Also uninstall old application form your device or emulator, Android studio does this automatically while installing but sometimes you may face errors and it will waste of time again. – Parmeshwar C May 09 '19 at 04:33
This needs to be done manually. Can't understand why refactoring is not working.. Rename folder and then respective files

- 388
- 2
- 7
The easiest way I have found to do this is to copy the project and then change the root folder name on the copy. Then just open copy as a new project in Android Studio.

- 163
- 1
- 2
- 9
- Right click on the root projects name.
Refactor -> Rename
- Change the name.
Rename directory -> Ok
.- Open
settings.gradle
and rename the:app
frominclude ':app'
with the new folder name including the:

- 14,932
- 12
- 99
- 105
My sure shot answer is : To refactor the root name
a) Rename the folder
b) then please go in settings.gradle > just write rootProject.name = 'new name'

- 322
- 1
- 13
-
Answers change position over time, so referencing an answer as being above or below is meaningless. – Jason Aller Oct 23 '19 at 04:22
-
@JasonAller while i am giving answer to a question i dont see "postion ". because my main focus is on question. i think stack overflow should let help people and get people help in more easy manner. – androminor May 14 '20 at 10:10
To avoid problems, use refactor: Change the left view from "Android" (where you see the files) to "Project". Right click on your project and select "Refactor/Copy". Now create your new project folder with windows explorer (otherwise you might get an IO Exception). After refactoring, be sure to select "Build/Clean Project" and then "Build/Make Project".

- 113
- 1
- 6
To change the name of the project's root directory, the following worked for me: As the image bellow indicates, under the 'Project' tab,
go to setting.gradle
modify/include rootProject.name='put the name you want here'
Then go to build -> clean project
build -> rebuild project

- 51
- 1
- 2
I have already up-voted to @Gorcyn's answer. However, it became a bit old info. So I try to update based on my own experience with Android Studio from 4.1.3 to Arctic Fox:
- Rename the project root directory name.
- Update the
rootProject.name
parameter in the project rootsettings.gradle
file. - Update
fileurl
andfilepath
attributes in the.idea/modules.xml
file. - Rename each
.iml
filename under the.idea/modules
(or project root) directory to correspond to the updatedfileurl
andfilepath
. - Update the
external.linked.project.id
attribute or theexternal.system.module.group
attribute in each.iml
file renamed above. - (Open an Existing Project)

- 11,633
- 6
- 46
- 69
My solution is:
- close android studio
- delete folders
.gradel
and.idea
- then re open the project

- 3,332
- 15
- 36
- 40