448

I want to change the name of my project and module. But if I try to rename them Android Studio notify me some errors...

e.g. I want to change the name from "MyApplication" to "AndroidApp" as shown in the image below.
enter image description here
In the first rectangle I want to change it in:

AndroidApp ("G:...\Android\AndroidApp).

In the second rectangle I want to change it in:

AndroidApp [AndroidApp-AndroidApp]

edit: This is the log:

Gradle: Project 'AndroidApp' not found in root project 'MyApplicationProject'.

build.gradle:

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.+' } } apply plugin: 'android' repositories { mavenCentral() } android { compileSdkVersion 18 buildToolsVersion "18.0.1" defaultConfig { minSdkVersion 7 targetSdkVersion 16 } } dependencies { compile 'com.android.support:support-v4:18.0.0' } 

settings.gradle:

include ':MyApplication' 
11
  • how have you change the name ? By using Refactor>Rename ? Commented Aug 16, 2013 at 20:40
  • 1
    Yes. I've did it in this way. Commented Aug 24, 2013 at 13:11
  • Ok. Can you tell us a bit more about the errors in order to help you? Commented Aug 24, 2013 at 15:28
  • Ok. Can you post gradle files ? (1 setting.gradle & 2 build.gradle) Does the project directories is the same as the one displayed in your picture ? (dir AndroidApp under MyApplication) Commented Aug 25, 2013 at 19:16
  • 2
    I suggest that you copy everything in another folder (AndroidApp). In that copy, rename AndroidApp\MyApplication to AndroidApp\AndroidApp. Change the setting.gradle to "include ':AndroidApp'" and finally import all this new folder in a new Android Studio project. That should works. Commented Aug 26, 2013 at 11:17

40 Answers 40

752

This did the trick for me:

  • Close Android Studio
  • Rename project root directory name
  • Open Android Studio
  • Open the project
  • Clean project

If your settings.gradle contains the below line, either delete it or update it to the new name.

rootProject.name = 'Your project name' 

Edit:
Working in all versions! Last test: Android Studio Chimpmunk Jun 2022.

Sign up to request clarification or add additional context in comments.

15 Comments

A new .iml files is then created, can I safely delete the old one?
I don't know about this. If you do a search for your old project name with Ctrl+Shift+F, there are still a lot of references to it.
I had an .idea/.name file which needed to be updated as well.
don't forget to change app_name in strings.xml, otherwise it will build the apk with the old name
I still have to change the .idea/workspace.xml file
|
218

You can change the name that is shown in the title bar in the file ".idea/.name".

12 Comments

This does nothing on my end. After changing it I tried cleaning up the project restarting it and even rebooting. No changes anywhere. Afaik this no longer works.
Works great as of Android Studio 1.3.2
this changes only the title in Android Studio window but doesn't rename the project
Since Android Studio 2.2 this no longer works. The file is deleted every time Studio is started. It seems no longer possible to give the project a name. So if you close your project and expect the list of recent projects happy finding out what is what.
Don't know if this answers OP, but this is what I am searching for. Thanks.
|
72

Update: This is an out-dated response from 2013 and only works for v2.2.2 and below.


  1. Right-click on your root project directory

  2. Select Refactor -> Rename

  3. Select rename project and change the name there.

  4. Also Select rename module and change it there as well. If you get an message saying module name already changed thats fine.

  5. Now right-click on the project root folder again and select Open Module Settings.

  6. Under the Modules section remove whatever folders are associated to your old project name.

  7. Apply Settings and hit OK.

  8. Restart Android Studio.

7 Comments

For Gradle-based projects, which this is, bugs in Android Studio will prevent this from working properly.
The world did not come to an end when I just did a replace in files globally across the entire directory structure. But you need a tool that will rename folders as well as contents. I know this is cheating, but I'm a big cheater like that.
Confused with step 1: What is the "root project directory"? Is that within Android Studio, or at finder/explorer? If it's within AS, I have several directories at the lowest level (root). Should I do this to the "app" directory, or the one with my project's name (which is NOT where the source files reside), but neither lead to refactor->rename project. Using AS 2.1.2.
not working on 2.2.3, it prompts "can't rename root module"
android studio 3.2.1, can't rename root module error
|
65

Change the Project Name


Change the name of your project by closing the Android Studio, go to your project folder, rename it…


enter image description here


Delete the .idea folder and .iml file. (To show hidden folders, press Cmd + Shift + . (dot) ).


enter image description here


Open the settings.gradle file with a text editor, like VSCode, and change the rootProject.name to your new project name.


enter image description here


Done! The project name has been changed! Just open your project with the Android Studio and Gradle will sync again.

6 Comments

Thank you, love you, I had this issue with the name changed everywhere BUT the top of the window of Android Studio. I searched every file in the project for the name but couldn't find it all because of that hidden file .idea
Edit the project name in settings.geadle and invalidate the cache and restart, all done
I did not have the OldName.iml file but deleting .idea and changing settings.gradle still worked without it.
whats Cmd in Cmd + Shift + . (dot) !??
Worked for me on Windows, only difference was that I didn't have to delete the .iml file. It was either in the .idea folder or isn't part of a Android Studio project on Windows.
|
44

update July/2017: tested and worked


  1. Open project folder (you could open it through Android Studio itself see this )
  2. now close Android Studio
  3. change the yourOldProjectName.iml to the a new name
  4. rename the parent folder to the same new name.
  5. re-open Android Studio --> File --> Open--> path to your renamed.im

7 Comments

Alternative: Rename the Parent Folder only. Open project. You will see tso .iml file. Delete the .iml file with the older name.
I check the same solution with the 2.1.2 and working fine. +1 for the solution
It works but a few additional steps required otherwise it will give errors in AndroidMenifest.xml like cannot find symbol @mipmap/ic_launcher 1. Sync Project with gradle files. (stackoverflow.com/questions/17424135/…) 2. Clean & rebuild your application.
@Akshit not sure what has caused your experience but I just applied this solution on a Androidstudio 2.2.3 and I can assure you your comment is not needed because when you reopen the project it does the re-indexing automatically anyway.
Did not work for me. It still said "could not import module OldName", even though project folder and .iml had new name.
|
14

Just find the name " android:label="AppName" " from the Android Manifest . Just rename the label name (eg: "AppName" here) all such android:label in the AndroidManifest.xml . Just save it ! When you run the app you will see the new Name

Comments

13

UPDATE:

This answer is better.

OLD ANSWER: 1. Right click your

ackage name and Refactor -> Rename...

enter image description here

  1. When asked if you want to Rename directory or Rename package, choose Rename package

enter image description here

  1. Now in Finder, manually rename your root folder (the parent folder of your /app folder)

enter image description here

  1. Reopen project in Android Studio with new folder name

  2. Cmd + Shift + f for any instances of your old name in Android Studio, and change all of them to the new name.

  3. Change the applicationId in your build.gradle

BONUS ROUND:

  • You might need to update a .gitignore file if it was at the root of your project. Note that when swapping branches after doing this, you'll potentially see a bunch of files showing up in working changes, but don't worry they should go away after you merge in your renamed branch with updated .gitignore. Don't manually remove these as it can cause issues in Android Studio.
  • Delete your old root folder in Finder

2 Comments

This changes the package name, which is different from the project name.
Answer is not related to the question: question asks to change the name of the app folder, so that apk that is generated acquires the same name. You on the other hand are giving solution for the renaming of package that corresponds to the application id.
9

Just go to res>values>strings.xml. One line says Somethig-your name

<string name="app_name">Somethig-your name</string> 

Just replace your original name to

 <string name="app_name">Your Name</string> 

4 Comments

This changes a string in your app, not the module's name. Also, not a "code snippet". :P
Well yes, but the effect for the customer is the same. Also, thanks for the edit
@user3000140 that's not the op want to do.. read the answer first ,wrong answer may diminishes the quality of this plateform.
@user3000140 The OP asks for changing the project name, which does not cause any observable differences to the app user.
9
  1. Close Android Studio.

  2. Rename the folder of the root of the project. For example, change "MyApplication" to "Myblablabla".

  3. Delete the '.idea' folder.

  4. Open Android Studio, and import the updated project.

Comments

9

1.Edit settings.gradle file, change rootProject.name

rootProject.name = "FirebaseDemo" include ':app' 

2.Go to the project file folder, rename the file folder

3.Delete .idea folder in your project and rebuild the project

Comments

8

What worked for me is:

Go to

setting.gradle 
  1. Change the name in it.
  2. Go to the app root folder which you want to change and refactor--> rename it.
  3. Close the Android Studio.
  4. Browse to the folder and change the name
  5. Start Android Studio again.
  6. Do the gradle sync.

Comments

7

For one, I'd strongly suggest updating to the latest Android Studio (0.3.7 as of now); there are tons of bug fixes.

You're running into bug https://code.google.com/p/android/issues/detail?id=57692, which is that if you try to use the UI to rename modules or your project, it doesn't update the build files. Sorry, it's really broken right now. I'd suggest changing the directory names directly in the filesystem, and updating your settings.gradle file to reflect the changes. Your project on disk should look something like this (with many more files than what's shown here):

projectFolder |--settings.gradle |--applicationModuleFolder | |--build.gradle | |--src 

it uses projectFolder's name as the project name and applicationModuleFolder as the name of the module that your Android App lives in (the upper and lower outlined boxes in your screenshot, respectively). I think the way your project is set up now, they both have the same name; you can rename both to the same new name if you like, or you can give them different names; it doesn't matter.

Once they're renamed, edit your settings.gradle file; it will look something like:

include ':applicationModuleFolder' 

just change the name to your new name there as well. Once these changes are made, click the Sync Project with Gradle Files button in the toolbar (if you're running a very old version of Android Studio, it may not have that button, so you can close the project and reopen it in that case) and it should pick up the changes.

Comments

7

A very quick way to solve this as at November 2020 is by the following steps

  1. hit the shift key twice, a pop up will show search for a file named "settings.gradle" when it opens change the rootProject.name = "Old-name" to rootProject.name = "new name" then sync.

  2. hit the shift key twice, a pop up will show search for a file named "string.xml", when it opens change <string "app_name">old-name to <string "app_name">new-name

  3. close android studio

  4. locate androidStudioProject directory on your machine, open it and find the project by its old name, rename it to the new name.

  5. open Android Studio goto File > Open > "new name". open it from there.

this is currently working on Android Studio 4.1.1

Comments

7

For changing the project name only in title bar without impacting the project

  1. Go to settings.gradle(Project Settings)
  2. Change rootProject.name='Desired Name'
  3. Click on Sync Now

it will change the project name in the title bar immediately without restarting.

1 Comment

Sync is the trick to get it to work in real time!
6

You can try something like this in your settings.gradle file:

rootProject.name = "YOUR_PROJECT_NAME" 

After restarting of Android Studio it will also change text in title bar to YOUR_PROJECT_NAME.

Tested on Android Studio 2.2 RC2

Comments

6

Video tutorial: https://youtu.be/7aQjiae2doU

  1. Refactor the name to com.example.[NewFileName] in path:

    app>java>com.example.[OldFileName]


  1. Go to strings.xml and change code to <string name="app_name”>[NewFileName]</string> in path:

    app>res>values>strings.xml


  1. Go to build.gradle (Module: app) and change code to applicationId "com.example.[NewFileName]” in path:

    Gradle Scripts>build.gradle (Module: app)


  1. Go to settings.gradle (Project Settings) and change code to rootProject.name='[NewFileName]' in path:

    Gradle Scripts>build.gradle (Project Settings)


  1. Press Sync now prompt

  1. Rename your folder to [NewFileName] outside Android Studio

  1. Reopen your project and rebuild project in path:

    Build>Rebuild Project


Comments

5

Just change the application id in build.gradle

applicationId "yourpackageName" 

For changing application label, in manifest

<application android:label="@string/app_name" ... /> 

Comments

4

What works for me is,

Go To Build.gradle Change ApplicationId & sync project.

Right click on your project > Rename > Rename Package.

Run your app and boom.

Hope this works as did for me

Comments

3

Go to [Tool Window\Project] by Alt+1, and change the level on the top-left corner of this window to Project (the other two are Packages and Android), then you can rename the Project name by Shift+F6. Type in the new name and press OK.

If you just want to change the app name which appears in the system, you can modify the android:title in the manifest.xml.

Comments

3

You can easily rename using refactor.

  1. Write click on the project root folder and click refactor.

  2. Then click on the rename, there will be a popup, you can give new name there.

1 Comment

Would be good to mention that you want to hit "Rename Module" not "Rename directory"
3

To change the apps name in Android Studio:

  1. Close the project in Android studio and get rid of it from the quick start side of the launcher ( Should be a mini next to the name).

  2. Close Android Studio.

  3. Go into where your app file is located and rename it (Under My Documents Usually).

  4. Restart Android Studio, select add new project and navigate to the folder that was renamed.

Changing the label of the launcher of the application / The applications actual name:

  1. Go into your initial folder (app)
  2. Go into manifests
  3. Go into AndroidManifest.xml.
  4. Rename android:label= _____ to whatever you want to rename your app to

Eg: android:label="Developer Portal".

  1. Click Save All.

Comments

3

For me the following works:

  1. Close Android Studio.
  2. Rename the folder of the project from MyApplication to NewProjectName
  3. Rename MyApplication.iml file to NewProjectName.iml
  4. in NewProjectName.iml change every MyApplication text to NewProjectName
  5. in .idea/modules.xml change every MyApplication text to NewProjectName
  6. in .idea/workspace.xml change every MyApplication text to NewProjectName
  7. Start Android Studio.
  8. All the previous settings remain, and "app" module as well!

Comments

2

Here's what I did in Android Studio Beta (0.8.14)

  1. Changed the package name manually in the manifest file
  2. Navigated to build -> source -> r -> release and drilled down until I found R.java
  3. Selected the file and pressed F6 to rename
  4. Then from the Build menu selected Make Project
  5. Clicked the first error and pressed Shift+F6 on the package name and renamed which updated all my source files
  6. Selected my project name in Android Studio, right clicked -> Refactor -> Rename and changed the name there too.
  7. Next went to app -> build.gradle and updated my applicationId
  8. Navigate to .idea -> .name file and rename your Android Studio project in there too
  9. Just to clean up I deleted the old package folder inside build -> source -> r -> release

And vola, my package name has now changed and builds successfully.

Comments

2

Here is how it all changes in seconds... in your "manifest.xml" find "android:label=" in front of it just type your new name inside "" for example: android:label="My new name"

Its done! your welcome ;)

Comments

2

TL;DR:

You may only follow the last part Renaming, maybe only images in it ... ;-)


Terminology:

There is no such thing as Android Studio's “Project name”. But they are other names, entered during creating a new project:

  • application name, which is initially the same as the Gradle's root project name,
  • the package name,
  • Android Studio project root folder name.

In general, people want to change these 3 names, mostly to be derived from the Gradle's root project name in the same way as it is proposed in the New Project dialog window.

So my answer will cover this case.


Analysis:

We may to follow the same steps as Android Studio does when creating a new project.

If you chose File → New → New Project... (and then a project template), the first field in the New Project dialog window is the “Name” field with offered name My Application.

The 2 next fields uses this (default or changed) name to derive the default for 2 other strings, so there are 3 important strings, for example

  1. My Application
  2. com.something.myapplication
  3. C:\Users\someuser\AndroidStudioProjects\MyApplication

Moreover,

  • just after creating a project, there are yet no builds which would use those 3 strings.

Renaming:

So, there are 4 things which we have to ensure during renaming to other name – I will use the name My Renamed Project as a base for new names.

Let's begin with the last, probably the simplest one:

  • Build -> Clean Project

Please, no new build from this moment until the full renaming finishes.

Now, begin renaming by previously specified 3 points:

  1. My Application:

    In the leftmost position of the title bar of the Android Studio Window, you see the same text as I selected in the settings.gradle file:

    enter image description here

    Change this text to the new name (My Renamed Application). The yellowish bar will appear near the top.
    Click the “Sync Now” in the right-hand part of it:

           enter image description here

    You will immediately see the change in the title bar:

    enter image description here

    You probably want to change the application name to the same name, too, so change it in the strings.xml resource file (the change will then reflect in the AndroidManifest.xml file, which is important):

    Before renaming:

    enter image description here

    After renaming:

    enter image description here

     

  2. com.something.myapplication:

    Change the applicationID in the build.gradle (module level) file - the new name, derived from “My Renamed Application” will be without spaces, all lowercase, i.e. myrenamedapplication:

    Before changing:

    enter image description here

    After changing:

    enter image description here

    The yellowish bar will appear again near the top.
    Click the “Sync Now” in the right-hand part of it:

           enter image description here

     

  3. Now close the Android Studio, and rename the folder

    MyApplication 

    (probably located in the folder C:\Users\someuser\AndroidStudioProjects\)

    to

    MyRenamedApplication 

    (the name, derived from “My Renamed Application”, is without spaces).

    Although this step is optional, it is highly recommended to keep things tidy.

Note:

Opening the renamed project with File → Open Recent will of course fail, so for the first time after renaming, open it with File → Open.

Comments

2

Changing following thing worked for me. settings.gradle-> rootProject.name='MyEvinApp' change rootProject.namewill take Android Studio as project name.

Comments

1

Try to change android:label in AndroidManifest.xml and reinstall/rerun app:

<application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme"> 

1 Comment

AndroidManifest.xml references @string/app_name, so the following change needs to be made in res/values/strings.xml: <string name="app_name">Your New App Name</string>
1

The way it worked for me in order to replace the old name of my project for a new one (everywhere in my codebase) is the following:

  1. Close Android Studio.
  2. Rename the root folder of your project.
  3. Open Android Studio. It will not find the old project, so you must import it again. This step will generate the configuration again (no need to touch your .idea files manually), including a new .iml file with the new project name. Afterwards you can delete the old .iml file if you want.
  4. Once the renamed project is imported in Android Studio you need to rename your source packages to use the new project name in case you used the old project name as part of the package path.

NOTE: This worked for Android Studio 2.1.2

Comments

1

I just went into the manifest and changed android:label="...." to the name of the application. Once Id changed this, the title and the actual app name changed to that :)

Comments

1
  • Changing the name in res>values>strings.xml will change the app name that is shown in the apps menu after installation

  • Renaming the android studio project folder (when android studio is closed) will likely satisfy many developers

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.