If you copy a project and want to work on the copy, you should rename and refactor the copy. In the following steps we assume the original project is called ExistingProject project and the copied project will be called NewProject. Here are the steps to refactor the project, replace your actual project names for ExistingProject and NewProject:

  1. If ExistingProject is still open in Android Studio, close it by selecting File > Close Project and use your system file navigator to find the folder containing the project
  2. Copy the ExistingProject folder to a new location and rename it NewProject
  3. In Android Studio, select Open an existing Android Studio project and open the renamed NewProject project in Android Studio
  4. Select Build > Clean Project to remove the auto-generated files.
  5. If it is not already visible, click the 1:Project side-tab and choose Android from the drop-down menu to see your files in the Project: Android view.
  6. Expand the app > java folder.
  7. Right-click uk.aston.existingproject and select Refactor > Rename. A Warning dialog is displayed. Select Rename package.
  8. The Rename dialog is displayed. Give a new name to your project, newproject.
  9. Select both Search in comments and strings and Search for text occurrences. Click Refactor.
  10. The Find: Refactoring Preview pane appears, showing the code to be refactored. Click Do Refactor.
  11. Expand the res > values folder and double-click the strings.xml file.
  12. Change the app_name string value to New Project.
  13. Check the AndroidManifest.xml and ensure that the package name has been refactored. The opening element should look like this:
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    	package="uk.aston.newproject">
    
  14. Open build.gradle(Module: app) and ensure that the applicatioId has been renamed:
    defaultConfig {
    	applicationId "uk.aston.newproject"
    
  15. Open settings.gradle(Project Settings) and ensure that the rootProject.name has been updated. That file should look like this:
    include ':app'
    rootProject.name = "NewProject"
    
    After you change the value of rootProject.name, click Sync now which should appear at the top right hand corner of the Android Studio editor window.
    Tip: Another way to sync your Gradle files is to select File > Sync Project with Gradle Files.
  16. You should now be able to rebuild your project by selecting Build > Rebuild Project.
  17. Once the project is built you should be able to run it on the emulator.

Here is an animate image of the above steps being followed in Unit 1.2a to copy and rename the "helloToast" project to "HelloToastChallenge" (if this image is too small, try right clicking the image and choose Open image in new tab):
Refactor the project