429

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'
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
RobertoAV96
  • 5,843
  • 4
  • 16
  • 13
  • how have you change the name ? By using Refactor>Rename ? – Rémi F Aug 16 '13 at 20:40
  • 1
    Yes. I've did it in this way. – RobertoAV96 Aug 24 '13 at 13:11
  • Ok. Can you tell us a bit more about the errors in order to help you? – Rémi F Aug 24 '13 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) – Rémi F Aug 25 '13 at 19:16
  • This is the project directory: "G:\Roberto\Informatica\Progetti-Applicazioni\Android\MyApplicationProject" – RobertoAV96 Aug 25 '13 at 22:35
  • In fact, your module should be in MyApplicationProject\AndroidApp folder and MyApplicationProject's build.gradle should be "include ':AndroidApp'. Have you tried building in command line ? (gradlew clean assemble --daemon) – Rémi F Aug 26 '13 at 09:17
  • I've edited the question adding some details and changing the image which now sows all the path... – RobertoAV96 Aug 26 '13 at 10:48
  • 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. – Rémi F Aug 26 '13 at 11:17
  • I've solved the problem by creating a new project with the new name and taking the sources from the old project. – RobertoAV96 Aug 26 '13 at 21:26
  • possible duplicate of [Android Studio Rename Package](http://stackoverflow.com/questions/16804093/android-studio-rename-package) – JG in SD Dec 01 '14 at 16:59
  • There are instructions here: https://google-developer-training.github.io/android-developer-fundamentals-course-concepts-v2/appendix/appendix-utilities/appendix-utilities.html – Amber May 10 '19 at 16:55

38 Answers38

726

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.

Ilya Gazman
  • 31,250
  • 24
  • 137
  • 216
  • 8
    A new .iml files is then created, can I safely delete the old one? – Leon Sep 18 '15 at 10:10
  • If your "run" button gives an error about not being able to install the app after you do this, then you could still get it to work by disabling instant run (file > settings > build, execution, deployment > uncheck enable instant run, android studio v 2.3). – Peeyush Kushwaha Mar 05 '17 at 11:28
  • 15
    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. – Suragch Sep 05 '17 at 07:32
  • 4
    I had an .idea/.name file which needed to be updated as well. – Magnus Mar 26 '18 at 08:52
  • 19
    don't forget to change app_name in strings.xml, otherwise it will build the apk with the old name – shabby Mar 05 '19 at 10:16
  • 1
    @shab Could you *then* run Find/Replace to replace all instances of the old name in the project files? Incl. `app_name`? – n00dles Apr 09 '19 at 19:58
  • 1
    Package name, app name and some other files names aren't changed. – Tamim Attafi May 17 '19 at 07:30
  • Still working in 2019 using Android Studio 3.4.1. After performing the steps on this answer I also had to do "File -> Sync Project with Gradle Files" update the Run/Debug configurations – Leo Jul 12 '19 at 06:41
  • Running "Clean Project" is absolutely required. Without this, the old name will appear in the list of projects when you start up Android Studio. I'm running Android Studio 3.5. You would think that Google would fix this and do an automatic clean when renaming a project. – Johann Aug 25 '19 at 07:15
  • 1
    I still have to change the `.idea/workspace.xml` file – user1801605 Jun 27 '20 at 02:03
  • In `settings.gradle` use `rootProject.name=''`. Then under .idea folder create a file called .name' with single line ''. The project window will show . This way you can keep your project directory name and project name separate. – Susanta Dec 20 '20 at 09:24
  • @n00dles No, if the new name is the old name plus some characters at the end (or start) – Benur21 Feb 26 '21 at 22:15
  • Renaming my project, I also renamed the classes paths. To correctly import the R resources, I also had to edit the manifest file updating the following attribute: – albaspazio Jul 23 '22 at 09:49
  • This did not work for me, I had to rename via `refactor` -> `rename` button – Oleg991 Aug 12 '23 at 19:31
212

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

Moritz
  • 10,124
  • 7
  • 51
  • 61
  • 3
    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. – Madmenyo Sep 04 '15 at 04:47
  • 1
    Works great as of Android Studio 1.3.2 – Jade Sep 29 '15 at 20:10
  • 40
    this changes only the title in Android Studio window but doesn't rename the project – Luca S. Dec 30 '15 at 22:53
  • It works in Android Studio 1.5.1 Just restart Android Studio after changing the name – Tejzeratul Feb 18 '16 at 06:01
  • It works with Android Studio 2.0 Beta 6 too. Just do that, rename your directory accordingly, start Studio, ado a clean and that's it. – Shlublu Mar 09 '16 at 10:12
  • @Moritz can you please add a screenshot ot it, I am unable to follow it. – Prafulla Kumar Sahu Mar 15 '16 at 12:05
  • Android Studio 2.1.2 - Changed the name from .idea\.name - From File>Invalidate Caches / Restart ; restarted the project But it only changes the project name in the title bar of Android Studio – Yousuf Azad Jul 14 '16 at 15:19
  • Working here after restarting Android Studio – David Aug 05 '16 at 06:53
  • 4
    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. – drindt Oct 05 '16 at 12:46
  • Works great in Android Studio 3.5.2! Thanks! – wayneiny Nov 29 '19 at 18:58
  • Don't know if this answers OP, but this is what I am searching for. Thanks. – Ricky Mo Sep 10 '20 at 07:44
  • This worked for me along with changing rootProject.name on settings.gradle. Thanks – Kaushik R Dec 09 '22 at 21:05
71

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.

starball
  • 20,030
  • 7
  • 43
  • 238
askilondz
  • 3,264
  • 2
  • 28
  • 40
  • 15
    For Gradle-based projects, which this is, bugs in Android Studio will prevent this from working properly. – Scott Barta Dec 06 '13 at 17:57
  • Just to remind you must perform step 8 (Restart AS), otherwise the old module would be recreated each time you build new module. – anticafe Feb 12 '15 at 03:26
  • 1
    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. – toddmo Apr 04 '15 at 20:38
  • I had to change module name in settings.gradle too – Karan Aug 17 '15 at 10:09
  • 3
    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. – SMBiggs Jun 12 '16 at 07:06
  • 26
    not working on 2.2.3, it prompts "can't rename root module" – worldask Feb 21 '17 at 06:22
  • 3
    android studio 3.2.1, can't rename root module error – Karan Harsh Wardhan Feb 08 '19 at 07:18
53

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.

VIISHRUT MAVANII
  • 11,410
  • 7
  • 34
  • 49
  • 1
    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` – SKREFI Feb 23 '20 at 10:55
  • 1
    Edit the project name in settings.geadle and invalidate the cache and restart, all done – Chris Ho Nov 21 '22 at 03:34
  • 1
    I did not have the `OldName.iml` file but deleting `.idea` and changing `settings.gradle` still worked without it. – Lifes Feb 10 '23 at 17:07
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
bastami82
  • 5,955
  • 7
  • 33
  • 44
  • 2
    Alternative: Rename the Parent Folder only. Open project. You will see tso .iml file. Delete the .iml file with the older name. – Yousuf Azad Jul 14 '16 at 15:28
  • 1
    I check the same solution with the 2.1.2 and working fine. +1 for the solution – King of Masses Aug 30 '16 at 09:03
  • 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. (http://stackoverflow.com/questions/17424135/android-studio-android-manifest-doesnt-exists-or-has-incorrect-root-tag) 2. Clean & rebuild your application. – akshitmahajan Dec 11 '16 at 18:21
  • @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. – bastami82 Dec 21 '16 at 11:14
  • 2
    Did not work for me. It still said "could not import module OldName", even though project folder and .iml had new name. – Azurespot Feb 08 '17 at 21:07
  • @Noni A why OldName !? try step 5 again, you should re-open it from file->open-> navigate to newName.im and do not forget to do step 2 when you changing the names. – bastami82 Feb 24 '17 at 08:08
  • If you rename the iml file you should change "external.linked.project.id" to the new name – Alexis R Dec 15 '17 at 16:01
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
Adam Johns
  • 35,397
  • 25
  • 123
  • 176
  • 4
    This changes the package name, which is different from the project name. – Leo Lei Dec 14 '17 at 07:14
  • 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. – Abhinav Saxena Jun 23 '18 at 08:15
12

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

NIKHIL PUNNOOSE
  • 129
  • 1
  • 6
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>
Troy Stopera
  • 302
  • 3
  • 15
user3000140
  • 319
  • 2
  • 11
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.

Pang
  • 9,564
  • 146
  • 81
  • 122
hedgehog
  • 637
  • 7
  • 8
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

vanshu
  • 537
  • 1
  • 7
  • 17
8

What worked for me is:

GoTo

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.

And you are done!

Uzair
  • 1,529
  • 14
  • 17
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.

Scott Barta
  • 79,344
  • 24
  • 180
  • 163
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

Mubarak Tahir
  • 207
  • 3
  • 4
5

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

Prizoff
  • 4,486
  • 4
  • 41
  • 69
5

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


myworldbox
  • 361
  • 6
  • 11
4

Just change the application id in build.gradle

applicationId "yourpackageName"

For changing application label, in manifest

<application 
android:label="@string/app_name" 
... />
Aziz
  • 1,976
  • 20
  • 23
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.

NicolasMoise
  • 7,261
  • 10
  • 44
  • 65
蓝钦城
  • 53
  • 5
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.

Sudharshan
  • 348
  • 1
  • 9
3

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

Saeed Rehman
  • 165
  • 3
  • 14
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.
Jamie A-Reade
  • 107
  • 1
  • 5
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!
voodoo98
  • 175
  • 2
  • 4
3

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.

PRANAV SINGH
  • 1,000
  • 11
  • 17
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.

Leigh
  • 1,495
  • 2
  • 20
  • 42
2

changing following thing worked for me. settings.gradle-> rootProject.name='MyEvinApp' change rootProject.namewill take android studio as project name

Mohd Qasim
  • 896
  • 9
  • 20
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">
Sufian
  • 6,405
  • 16
  • 66
  • 120
thron1115
  • 19
  • 1
  • AndroidManifest.xml references @string/app_name, so the following change needs to be made in res/values/strings.xml: Your New App Name – Carl Smith May 31 '15 at 02:42
1

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 ;)

mohsen
  • 41
  • 3
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 :)

Jamie A-Reade
  • 107
  • 1
  • 5
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

Antonello
  • 11
  • 1
1

Hello RobertoAV96,

I have provided three solutions here. Choose whichever applies to your problem.

If you want to just change the name of the project root folder name, you can do it from the explorer:

  1. Just close the project in the studio, after copying path to the project. Close the project from the main welcome screen.
  2. go to the file explorer, copy this path on the address bar, and go to the folder.
  3. Rename the folder that is the root of the project.
  4. Rename the iml file in this root folder to the name of the folder. That is if the project root folder's name was say demo_project, there will be demo_project.iml file inside it. If you changed this folder's name to say my_project, then you have to change the name of the iml file inside it to my_project.iml.

Actually the refactor option from the Studio can do the same.

If you want to change the app folder's name, that is inside the root folder of the project, do the same in the explorer:

  1. Rename the app folder to the name you like to have.

[INFO: The APK file, that is generated for this project, will acquire the same first name followed by the suffix that represents the mode you build the signed APK for, that is either debug or release. Signed APK is found in it's respective folder of debug or release. The unsigned APK is located in output folder of build directory, all build, debug and release folders are found in the primary app folder, or the folder you have renamed this folder to].

  1. Suppose the name that you have given to this folder is my_project_app, open the folder and rename the app.iml, to my_project_app.iml after the name of the project.
  2. Now go to the project's root folder, and find the settings.gradle file.

The content of this file are the names of module folders that you include in the project, currently there is only one module, that is the main one :

include ':app'

This is corresponding to the old name of the app folder.

Hence you have to make the changes:

include ':my_project_app'

That's it. Now you can reload the project in the studio, and check the name of the APK that is generated.

If you want to rename the package name, say com.first.myproject to com.alpha.myproject:

  1. Again go to the explorer: Inside the hierarchy of folders in the src-->main-->java, your package is com-->first-->myproject. Make sure your Studio is closed.
  2. Rename the second folder first to alpha.
  3. Open the Studio now. Choose Replace in Path in the first package inside the java folder, in the Android mode of the left panel tree. This one is the package that you changed from the Explorer, that is: com.alpha.myproject instead of com.first.myproject. Change the instances of the string import com.first.myproject; in files to import com.alpha.myproject;. Check for just the string occurrence of com.first.myproject, and safely change it to com.alpha.myproject.
  4. Check for just the string occurrence of com.first.myproject, in build.gradle inside your main app module, and safely change it to com.alpha.myproject.
  5. Do not forget that this package name is also the signature and identity to your application project. If you have already published your application in the play store, then you have to setup a different project com.alpha.myproject afresh and unpublish com.first.myproject, affecting lots of users:- you have to broadcast to the users using push notification, in the latest version of old existing APK, that the new Application version will be released with different name, and you have to publish this new APK, restarting from version name 1.0. This destroys objective of having the application slot at play-store for the old APK. So you have to consult your client that what should be the name of their application package before starting the project.
  6. Don't forget that the signing and obfuscation of the application is equally important. You can issue command inside Studio to remove unnecessary resources from your project. You can manually deal with all the warnings that LINT produces.

Happy coding and Happy app publishing. :-)

Abhinav Saxena
  • 1,990
  • 2
  • 24
  • 55
1

This approach 100% working

Just do these simple step:

  • Exit Android Studio
  • Rename the main project folder from your explorer
  • Open Android Studio and Open your project
  • Rebuild and Enjoy.
Amir Hossein Ghasemi
  • 20,623
  • 10
  • 57
  • 53
0

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

narko
  • 3,645
  • 1
  • 28
  • 33
0

Close the android studio and Just rename the .iml file in your file explorer That's it

Mudit
  • 84
  • 1
  • 5
0

These instructions below worked (first time) for me in Android Studio 2.3. They involve creating a new app in Android Studio, then closing it and doing all the work in a file explorer and a text editor.

Refactor and Rename a Android Studio Project or App

Note: Requires a text editor which can do a global search-and-replace in a directory structure. The instructions propose Sublime Text, which I easily installed and ran.

It produced a new app which installed and ran beside the existing app. It still had the same screen name, which was fixed by editing Android:label="MyNewApp" in the manifest.

Stephen Hosking
  • 1,405
  • 16
  • 34
0
  1. first go to the values folder
  2. then go to the String Folder
  3. find the app_name
  4. Change the name of the application in string Tag
  5. Finished
0

it will work fine for me

Change Following.

Step 1: Make sure ApplicationId And PackageName will Same. example :

  android {
  defaultConfig {
                     applicationId "com.example.myapplication"
                 }
       }
 and package name the same. package="com.example.myapplication"

Step 2 delete iml file in my case :

  Go To Project> >C:\Users\ashif\Documents\MyApplication  .iml file // delete 
if you forget Project Path Then Go To android Studio Right Click on app and go to  Show in Explorer you get your Project and remove .iml file

Step 3 Close Project

Step 4 Now Copy Your old Project and Paste Any other Root or copy Project Folder and paste Any other Dir.

 Example C:\Users\ashif\Documents/MyApplication 

Step 5

Now open Android Studio and open Existing Project 
C:\Users\ashif\Documents/MyApplication 

Try it will work

Ashif
  • 441
  • 5
  • 12
0

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.

MarianD
  • 13,096
  • 12
  • 42
  • 54
0

Just edit rootProject.name in settings.gradle file. Then I exported the entire project to .zip, extracted and opened it, and the name was updated.

mcdaqc
  • 31
  • 5
-2

To just rename the project:

  1. Refractor and rename the top level directory
  2. Close Android Studio
  3. IMPORT the whole project again

To change the package name:

The easiest and fastest solution is here: https://stackoverflow.com/a/35057550/4908798

Timo Schuck
  • 314
  • 3
  • 11