简体   繁体   English

重命名Android Studio包

[英]Rename Package Android Studio

I know there is a lot of info on this here. 我知道这里有很多信息。 But I can't find the answer to my particular question. 但是我找不到我的特定问题的答案。

I'm trying to rename a package that is currently like this: 我正在尝试重命名当前如下所示的包:

com.example.app.name

and I want to rename it to 我想重命名为

com.example.name

I know you have to do refactor rename and make sure you have 'compact empty middle packages' turned off but I'm only know how to rename them when they are three directories long ie com.example.name and not how to actually get rid of one of the directories. 我知道您必须进行重构重命名并确保已关闭“紧凑的空中间包”,但我只知道当它们有三个目录(即com.example.name长时如何重命名它们,而不是如何真正摆脱它们其中之一的目录。 So how do I reduce it from being 4 to only 3? 那么如何将其从4减少到3?

Hope I explained this correctly. 希望我能正确解释。

Refactor the package name in the manifest file. 在清单文件中重构软件包名称。 Make sure to hit the "Do Refactor" button in the Find window. 确保点击“查找”窗口中的“执行重构”按钮。

Also, you will need to edit the package name in the build.gradle file. 另外,您将需要在build.gradle文件中编辑软件包名称。

I think that's it. 我想就是这样。

Rename Package Android Studio com.example.app.name to com.example.name 将包Android Studio com.example.app.name重命名为com.example.name

Steps: 脚步:

  1. Close/Unselect Compact Empty Middle Packag. 关闭/取消选择紧凑空中间包装。
  2. Move all source from "name" to "app". 将所有源从“名称”移动到“应用”。
  3. Delete "name". 删除“名称”。
  4. Change "app" to "name". 将“ app”更改为“ name”。 :D :D

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM