Copy existing project with a new name in Android Studio

If you use Gradle - don't forget to change applicationId attribute in app/build.gradle file.


The steps in the link you specified should also work for Android Studio. Just make a copy (using a file manager) of the entire module folder and give it a new name. Now open it up and use Refactor -> Rename (right click on the item you want to rename) to rename your module and package.

See this for details about refactoring in IntelliJ/Android Studio.


As free3dom pointed out, here's what should be done:

  1. Create a copy using file manager
  2. Manually edit the app's build.gradle file to change the package name (you can use the file manager).
  3. Manually edit AndroidManifest.xml to change the package name.
  4. Run gradle sync.
  5. Open the project in Android Studio, and refactor the package name.
  6. Run gradle sync, again.

That seems to work without any problems.


If you are using the newest version of Android Studio, you can let it assist you in this.

Note: I have tested this in Android Studio 3.0 only.

The procedure is as follows:

  1. In the project view (this comes along with captures and structure on the left side of screen), select Project instead of Android.
    The name of your project will be the top of the tree (alongside external libraries).
    Select your project then go to Refactor -> Copy....
    Android Studio will ask you the new name and where you want to copy the project. Provide the same.

  2. After the copying is done, open your new project in Android Studio.
    Packages will still be under the old project name.
    That is the Java classes packages, application ID and everything else that was generated using the old package name.
    We need to change that.
    In the project view, select Android.
    Open the java sub-directory and select the main package.
    Then right click on it and go to Refactor then Rename.
    Android Studio will give you a warning saying that multiple directories correspond to the package you are about to refactor.
    Click on Rename package and not Rename directory.
    After this step, your project is now completely under the new name.

  3. Open up the res/values/strings.xml file, and change the name of the project.
  4. Don't forget to change your application ID in the "Gradle Build Module: app".
  5. A last step is to clean and rebuild the project otherwise when trying to run your project Android Studio will tell you it can't install the APK (if you ran the previous project).
    So Build -> Clean project then Build -> Rebuild project.
    Now you can run your new cloned project.