在android中重命名项目的简便方法

时间:2022-02-01 14:54:57

I have downloaded an Android project. To avoid name conflicts I want to move it from com.android.zzz to com.my.zzz. At the moment I'm using Ecplise with the standard android toolkit. Is there a better way to do the rename than to go manually through the files?

我已经下载了一个Android项目。为了避免名称冲突,我想将它从com.android.zzz移动到com.my.zzz。目前我正在使用Ecplise和标准的android工具包。有没有比手动浏览文件更好的方法进行重命名?

2 个解决方案

#1


41  

This is basic IDE refactoring.

这是基本的IDE重构。

Right click the package in Eclipse -> Refactor -> Rename.

右键单击Eclipse中的包 - >重构 - >重命名。

You will probably want to check all the options that come up in the Rename dialog.

您可能希望检查“重命名”对话框中出现的所有选项。

Another option would be to right click the class files in Eclipse -> Refactor -> Move.

另一种选择是右键单击Eclipse中的类文件 - >重构 - >移动。

#2


10  

As usual, by pressing F2 on package name, you can rename or change the package name, and also by Right-clicking and then select Rename option, you can change or rename the Package name.

像往常一样,通过按包名称上的F2,您可以重命名或更改包名称,也可以通过右键单击然后选择重命名选项,您可以更改或重命名包名称。

When you press F2, it will show you the dialog box as:

当您按F2时,它将显示如下对话框:

alt text

In this dialog, dont forget to check "Update references" check box because by making "check" to this check-box, it will make changes to all the references of the package which are referred by other components of project.

在此对话框中,不要忘记选中“更新引用”复选框,因为通过对此复选框进行“检查”,它将更改项目的其他组件引用的包的所有引用。

Hope this helps you,

希望这能帮到你,

#1


41  

This is basic IDE refactoring.

这是基本的IDE重构。

Right click the package in Eclipse -> Refactor -> Rename.

右键单击Eclipse中的包 - >重构 - >重命名。

You will probably want to check all the options that come up in the Rename dialog.

您可能希望检查“重命名”对话框中出现的所有选项。

Another option would be to right click the class files in Eclipse -> Refactor -> Move.

另一种选择是右键单击Eclipse中的类文件 - >重构 - >移动。

#2


10  

As usual, by pressing F2 on package name, you can rename or change the package name, and also by Right-clicking and then select Rename option, you can change or rename the Package name.

像往常一样,通过按包名称上的F2,您可以重命名或更改包名称,也可以通过右键单击然后选择重命名选项,您可以更改或重命名包名称。

When you press F2, it will show you the dialog box as:

当您按F2时,它将显示如下对话框:

alt text

In this dialog, dont forget to check "Update references" check box because by making "check" to this check-box, it will make changes to all the references of the package which are referred by other components of project.

在此对话框中,不要忘记选中“更新引用”复选框,因为通过对此复选框进行“检查”,它将更改项目的其他组件引用的包的所有引用。

Hope this helps you,

希望这能帮到你,