Android Studio项目根目录名称更改/项目名称更改

时间:2023-01-24 16:35:08

How to change the name of a project's root directory in Android Studio- 0.9.9.I read the other solution here but nothing works for me. I can change/refactor the package name but not the name of the root directory .I found another solution here,which is to change the name in .idea/.name file, which didnt work.After I changed name, I tried cleaning,rebuilding etc but nothing reflected the changes in android studio.There is no REFACTOR option for "PROJECT NAME/ROOT DIRECTORY NAME", many people here confused the module name with project name/root directory name.

如何在Android Studio-0.9.9中更改项目根目录的名称。我在这里阅读其他解决方案,但对我来说没有任何作用。我可以更改/重构包名称,但不能更改根目录的名称。我在这里找到了另一个解决方案,即更改.idea / .name文件中的名称,该文件无效。我改名后,我尝试清理,重建等但没有反映android studio中的变化。“PROJECT NAME / ROOT DIRECTORY NAME”没有REFACTOR选项,很多人在这里将模块名称与项目名称/根目录名称混淆。

6 个解决方案

#1


50  

You can change the directory name and reimport the project as @user3106978 commented.

您可以更改目录名称并重新导入项目,如@ user3106978所述。

You can also change the name of the project in the Android Studio project structure by editing some files :

您还可以通过编辑一些文件来更改Android Studio项目结构中项目的名称:

  • Change the project name in .idea/.name
  • 在.idea / .name中更改项目名称

  • Rename the [Name].iml file in the project root directory
  • 重命名项目根目录中的[Name] .iml文件

  • Change the reference to this iml file in .idea\modules.xml
  • 在.idea \ modules.xml中更改对此iml文件的引用

#2


20  

  1. Close android studio

    关闭android工作室

  2. Change project root directory name

    更改项目根目录名称

  3. Open android studio

    打开android studio

  4. Open the project(not from local history but by browsing to it)

    打开项目(不是从本地历史记录,而是通过浏览它)

Worked for me @ Studio 2.1.3

为我工作@ Studio 2.1.3

#3


1  

This needs to be done manually. Can't understand why refactoring is not working.. Rename folder and then respective files

这需要手动完成。无法理解为什么重构不起作用..重命名文件夹然后各自的文件

#4


1  

The easiest way I have found to do this is to copy the project and then change the root folder name on the copy. Then just open copy as a new project in Android Studio.

我发现这样做的最简单方法是复制项目,然后更改副本上的根文件夹名称。然后只需在Android Studio中打开副本作为新项目。

#5


1  

  1. File->Close project

  2. Change project root directory name

    更改项目根目录名称

  3. Delete .iml files (by searching for them using windows search then deleting them)

    删除.iml文件(通过使用Windows搜索搜索然后删除它们)

  4. Delete .idea directory

    删除.idea目录

  5. Open the project

    打开项目

#6


0  

To avoid problems, use refactor: Change the left view from "Android" (where you see the files) to "Project". Right click on your project and select "Refactor/Copy". Now create your new project folder with windows explorer (otherwise you might get an IO Exception). After refactoring, be sure to select "Build/Clean Project" and then "Build/Make Project".

为避免出现问题,请使用重构:将左侧视图从“Android”(您看到的文件)更改为“Project”。右键单击您的项目,然后选择“重构/复制”。现在使用Windows资源管理器创建新的项目文件夹(否则您可能会遇到IO异常)。重构后,请务必选择“构建/清理项目”,然后选择“构建/制作项目”。

#1


50  

You can change the directory name and reimport the project as @user3106978 commented.

您可以更改目录名称并重新导入项目,如@ user3106978所述。

You can also change the name of the project in the Android Studio project structure by editing some files :

您还可以通过编辑一些文件来更改Android Studio项目结构中项目的名称:

  • Change the project name in .idea/.name
  • 在.idea / .name中更改项目名称

  • Rename the [Name].iml file in the project root directory
  • 重命名项目根目录中的[Name] .iml文件

  • Change the reference to this iml file in .idea\modules.xml
  • 在.idea \ modules.xml中更改对此iml文件的引用

#2


20  

  1. Close android studio

    关闭android工作室

  2. Change project root directory name

    更改项目根目录名称

  3. Open android studio

    打开android studio

  4. Open the project(not from local history but by browsing to it)

    打开项目(不是从本地历史记录,而是通过浏览它)

Worked for me @ Studio 2.1.3

为我工作@ Studio 2.1.3

#3


1  

This needs to be done manually. Can't understand why refactoring is not working.. Rename folder and then respective files

这需要手动完成。无法理解为什么重构不起作用..重命名文件夹然后各自的文件

#4


1  

The easiest way I have found to do this is to copy the project and then change the root folder name on the copy. Then just open copy as a new project in Android Studio.

我发现这样做的最简单方法是复制项目,然后更改副本上的根文件夹名称。然后只需在Android Studio中打开副本作为新项目。

#5


1  

  1. File->Close project

  2. Change project root directory name

    更改项目根目录名称

  3. Delete .iml files (by searching for them using windows search then deleting them)

    删除.iml文件(通过使用Windows搜索搜索然后删除它们)

  4. Delete .idea directory

    删除.idea目录

  5. Open the project

    打开项目

#6


0  

To avoid problems, use refactor: Change the left view from "Android" (where you see the files) to "Project". Right click on your project and select "Refactor/Copy". Now create your new project folder with windows explorer (otherwise you might get an IO Exception). After refactoring, be sure to select "Build/Clean Project" and then "Build/Make Project".

为避免出现问题,请使用重构:将左侧视图从“Android”(您看到的文件)更改为“Project”。右键单击您的项目,然后选择“重构/复制”。现在使用Windows资源管理器创建新的项目文件夹(否则您可能会遇到IO异常)。重构后,请务必选择“构建/清理项目”,然后选择“构建/制作项目”。