Rename package in Android Studio

后端 未结 30 1977
深忆病人
深忆病人 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:05

    Be sure to go to Sheharyar's great Answer. There are so many answers and comments that follow it that it would be easy to get confused and give up, but don't. That answer works.

    In short, you do three things:

    (1) Deselect Compact Empty Middle Packages.

    (2) Refactor then Rename each old directory node by choosing Change Package (not Change Directory) to match the new package name. (Be sure to do a preview of changes.)

    (3) Edit the build.gradle file and make APPLICATION_ID match the new package name.

提交回复
热议问题