Rename package in Android Studio

后端 未结 30 1919
深忆病人
深忆病人 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 06:00

    Another good method is: First create a new package with the desired name by right clicking on the Java folder → NewPackage.

    Then, select and drag all your classes to the new package. Android Studio will refactor the package name everywhere.

    Finally, delete the old package.

    Done.

    Very important:

    You have to manually change AndroidManifest.xml and build.gradle file to the new package if you use this method.

提交回复
热议问题