Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to move and rename a project in android studio?

This should be a really simple question :)

I have a project that works fine. Now I wanted to rename it and to change the path of the projectfolder. First it seemd simple: right click -> "move" and "refactor/rename".

After moving and renaming my project folder and my apk modul there was not the same project-structur as before. My project libs have been included twice. I looked in the '.iml' files and saw that the previous path was included - so I changed this. After this I could compile my project over the command line but not with the IDE. There I got this error:

NullPointerException: no project directory specified 

Whats the default way to move and rename a project? I solved my problem by making a new project and copying all files, but it would be very cool to know the solution of this "problem".

EDIT:

Origin Project-Structure:

MyProject --- libraries --- MyApp 

After Moving:

MyProject --- MyProject (new path) --- MyProject (old path) 

I think I have to do more than just copy the project. Somehow I have to specify the "new" project, havn't I?

like image 437
owe Avatar asked Jul 05 '13 14:07

owe


People also ask

Can you rename a File in Android Studio?

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


2 Answers

Close the project in Android Studio (File -> Close Project). Move the project and rename it by moving its home folder/directory. Open the new project from Android Studio (File -> Open)

like image 196
Boris Pavlović Avatar answered Sep 23 '22 18:09

Boris Pavlović


In Android studio 0.8.+, you can click F6 to move it.

If you use 1.0.2 or higher, make sure you select the Project view for the Refactor -> Move menu option to become available.

Thanks to @DavidsAlias for pointing this out.

like image 28
Mohamed Taher Alrefaie Avatar answered Sep 23 '22 18:09

Mohamed Taher Alrefaie