Rename package in Android Studio

后端 未结 30 1983
深忆病人
深忆病人 2020-11-21 05:21

How do you rename packages in the new IDE Android Studio, based on IntelliJ IDEA?

Is there an automatic refactoring included?

I want to make bulk refactorin

30条回答
  •  灰色年华
    2020-11-21 05:50

    Updated answer: May 2015

    OK I have been struggling with cloning & renaming projects in Android Studio, but finally I achieved it. Here are the steps to follow:

    1. Copy the project folder, rename it & open it with Android Studio
    2. Rename module directory from explorer
    3. Rename projectName.iml and content
    4. Rename idea/.name content
    5. In your Project pane, click on the little gear icon -> uncheck "Compact Empty Middle Package"
    6. Refactor src directories for new package name (rename package, "not rename directory")
    7. In build.gradle rename application id
    8. settings.gradle rename module

    That's it...

提交回复
热议问题