Android的工作室重命名包 [英] Android Studio Rename Package
问题描述
如何在新的IDE的Android工作室命名的包,基于intelijj?
有没有自动重构包括在内?
我要进行大量的重构,但我不知道怎么办。我工作2年日食和月食它的点击操作。
在Android的工作室,你可以这样做:
例如,如果你想改变 com.example.app </ code>到
my.awesome.game
,然后
-
在您的的项目窗格的,点击小齿轮图标()
-
取消选中/取消选择
紧凑型空中间包
选项
<醇开始=3>
您封装目录将现在各个目录被分解
单独选择要重命名的每个目录和:
- 右键点击
- 选择
重构
- 点击
重命名
- 在弹出的对话框中,单击
重命名包
而不是重命名目录 - 输入新的名称,点击重构
- 允许一分钟,让Android的Studio更新所有更改
- 的注意:在机器人工作室更名
COM
,它会给出警告。在这种情况下,选择的全部重命名
- 现在,打开你的的摇篮构建文件的(build.gradle <$ C C $> - 通常
应用
或移动
)。更新的applicationID
到新的包名称和同步摇篮,如果尚未自动更新:
<醇开始=6>
How do you rename packages in new IDE Android Studio, based on intelijj ?
Is there any automatic refactoring included?
I want to make bulk refactoring but I don't know how. I worked 2 years with eclipse and in eclipse it's one click operation.
In Android Studio, you can do this:
For example, if you want to change com.example.app
to my.awesome.game
, then:
In your Project pane, click on the little gear icon ( )
Uncheck / De-select the
Compact Empty Middle Packages
option
Your package directory will now be broken up in individual directories
Individually select each directory you want to rename, and:
- Right-click it
- Select
Refactor
- Click on
Rename
- In the Pop-up dialog, click on
Rename Package
instead of Rename Directory - Enter the new name and hit Refactor
- Allow a minute to let Android Studio update all changes
- Note: When renaming
com
in Android Studio, it might give a warning. In such case, select Rename All
- Now open your Gradle Build File (
build.gradle
- Usuallyapp
ormobile
). Update theapplicationId
to your new Package Name and Sync Gradle, if it hasn't already been updated automatically:
- Done! Anyways, Android Studio needs to make this process a little simpler.
这篇关于Android的工作室重命名包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!