5

I want to change the project name in Android Studio. I have found some answers on Stackoverflow but it didn't work for me. Please suggest me some suitable solution.Currently I'm using Android Studio 2.3.
Thanks always :)

4
  • What solutions didn't work for you? Commented Jul 18, 2017 at 17:55
  • Changing .idea/.main. But I didn't find .main file in android studio 2.3 :'( Commented Jul 18, 2017 at 17:58
  • 1
    you shouldn't modify .idea files. you want to modify the directory name? Commented Jul 18, 2017 at 18:00
  • yes I want to modify root directory name, without affecting the project. Commented Jul 18, 2017 at 18:03

5 Answers 5

6

You need to perform a few steps

  • First move to project view and click on the small settings icon on the top right corner of project view, make sure the compact empty middle packages option is checked
  • Right click on your java folder and choose Refactor>Rename>change to your desired package name and confirm Refactor
  • than you MUST also change the project id in your build.gradle file
  • double check if your android manifest.xml refactored too(android studio should take care of it automatically but check again) this is the only method that changed the project name from the base for me.
Sign up to request clarification or add additional context in comments.

3 Comments

"compact empty middle packages" under Tree View now seems to now just say "compact middle packages" the word empty was maybe removed?
When you say "java folder" do you mean just the one under "main" under "app" ? Or the other 2 sub-sub-folders under "app" as well?
in Android Studio Giraffe | 2022.3.1 Patch 3 I get an error saying I can't rename when I click on the highest top level icon under project view which is called project_name. This probably isn't my "java" folder, but I'm not sure which folder to click as stated in my last comment.
1

This did the trick for me:

  • Close android studio
  • Change project root directory name
  • Open android studio
  • Open the project(not from local history but by browsing to it) Clean project

Check this: https://stackoverflow.com/a/28324892/4161284

Comments

0

Perform the following Steps:

Step 1 - Rename:

Step 1 - Rename

Step 2 - Update app name in String file:

Step 2 - Update app name in String file

Comments

0

What helps for me is:

  • Close Android Studio
  • Go to projects folder i.e. where the projects are saved (Documents)
  • Rename the desired folder to whatever you want (keep naming conventions)
  • Open renamed project in Android Studio and clean project
  • Open app -> java -> right click package name folder containing activity -> select rename and follow prompts
  • Project should be renamed.

Note: There might be a .iml file with the old name. It can be renamed if you want the project to be completely clean.

Comments

0

Below strategy worked for me:

  1. Close Android Studio
  2. Change Android Project root directory name
  3. Open Android Studio
  4. Open the project from Android Studio (Try not to open the project from android studio history but by browsing it)
  5. If settings.gradle contains the below line, change it to the new project name or remove it

    rootProject.name = 'Your project name'

  6. Clean the project and Build it

thanks

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.