6

In my present project , I wish to rename the Android project in Android studio (0.8.9) and wish to use it hereafter. I know about 2 solutions discussed in forum. Could some one please confirm best approach and hassle free. Moreover any advice tried/tested on Android studio 0.8.9 is best.

Solutions I know about (but not sure) A.- Close the project under consideration.Copy it and rename to new name and open with Android studio.
In this case - The project .iml file still shows the old name and so does the .name file under ".idea" folder. I also get this error:

Unsupported Modules Detected: Compilation is not supported for following modules: . Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

B. Using F6 option ,but it does not copy. I think it moves the entire project, which is not the solution.

Abhi
  • 227
  • 2
  • 5

3 Answers3

16

The following works for me when renaming the project:

  • Close Android Studio
  • Delete the *.iml file(s) in your project's root directory
  • Delete everything in the .idea directory except workspace.xml and tasks.xml.
  • Rename your project's root directory to the new project name
  • Restart Android Studio and import the project from the renamed directory.

Note: If you don't care about losing your workspace settings (window sizes, etc.) and you don't have any tasks then you can just delete the .idea directory entirely.

Rob Meeuwisse
  • 2,847
  • 1
  • 17
  • 21
5

In Android 1.5.1 tested and worked:

  1. Open Project folder (you could open it through Android studio itself see this
  2. make sure Android Studio Is closed
  3. change the yourOldProjectName.iml to the new name
  4. rename the parent folder to same new name.
  5. re-open Android Studio --> File --> Open--> path to your renamed.iml
Community
  • 1
  • 1
bastami82
  • 5,955
  • 7
  • 33
  • 44
  • This works for me in `version 2.1.2`. Not sure why `right click` -> `refactor` -> `rename` still doesn't work for the root module though... – Sakiboy Aug 03 '16 at 22:07
0

I found an easy way to solve this.

Open Android Studio, File -> Invalidate Caches / Restart -> Invalidate Caches & Restart.

William
  • 141
  • 5