Android的工作室重命名包重命名、工作室、Android

由网友(古灵精怪小妖精)分享简介:如何在新的IDE的Andr​​oid工作室命名的包,基于intelijj?有没有自动重构包括在内? 我要进行大量的重构,但我不知道怎么办。我工作2年日食和月食它的点击操作。解决方案 在Android的工作室,你可以这样做:例如,如果你想改变 com.example.app 到 my.awesome.game ,然后在...

如何在新的IDE的Andr​​oid工作室命名的包,基于intelijj?

有没有自动重构包括在内?

我要进行大量的重构,但我不知道怎么办。我工作2年日食和月食它的点击操作。

解决方案

在Android的工作室,你可以这样做:

例如,如果你想改变 com.example.app 到 my.awesome.game ,然后

在您的的项目窗格的,点击小齿轮图标()

取消选中/取消选择紧凑型空中间包选项

Android studio 如何重命名文件名

您封装目录将现在各个目录被分解

单独选择要重命名的每个目录和:

右键点击 选择重构 点击重命名 在弹出的对话框中,单击重命名包而不是重命名目录 输入新的名称,点击重构 允许一分钟,让Android的Studio更新所有更改 的注意:在机器人工作室更名 COM ,它会给出警告。在这种情况下,选择的全部重命名

现在,打开你的的摇篮构建文件的(build.gradle
- 通常应用移动)。更新的applicationID 到新的包名称和同步摇篮,如果尚未自动更新:

完成!的不管怎么说,Android的工作室需要使这个过程变得更简单。

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 - Usually app or mobile). Update the applicationId 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.

阅读全文

相关推荐

最新文章