Java 如何在 Android Studio 中重命名项目

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35050557/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 16:16:10  来源:igfitidea点击:

How to rename a project in Android Studio

javaandroidandroid-studio

提问by Wildfire Blake

I am currently using Android Studio 1.4.1, the latest version. I would like to distribute my program among my friends, but it was a school final, so it's named FinalProject. I'd like to rename it, however whatever I try to do (even using answers from this site), I can't seem to do it.

我目前使用的是最新版本的 Android Studio 1.4.1。我想将我的程序分发给我的朋友,但它是学校期末考试,所以它被命名为 FinalProject。我想重命名它,但是无论我尝试做什么(即使使用本网站的答案),我似乎都无法做到。

I've tried right-clicking the root file on the bread crumbs, but it says "Can't rename root module." I don't really know what else I can do.

我尝试右键单击面包屑上的根文件,但它显示“无法重命名根模块”。我真的不知道我还能做什么。

I've tried renaming the parts in the idea, build.gradle, and AndroidManifest.xml, but that didn't work. If I also rename it in the manifest, it breaks the entire manifest.

我已经尝试重命名想法中的部分 build.gradle 和 AndroidManifest.xml,但这没有用。如果我也在清单中重命名它,它会破坏整个清单。

采纳答案by Evin1_

This always works for me, it will change the project's name, but be careful, it will not rename its internal packages.

这总是对我有用,它会更改项目的名称,但要小心,它不会重命名其内部包

  1. Close everythingon your screen.
  2. Locate your project with your File explorer (Files, Finder, Windows Explorer or even the Terminal: $ cd your/path/to/file).
  3. Rename your project with the File explorer (make sure you do not get inside the project, just locate it).
  4. Open Android Studio.
  5. Importthe renamed project.
  1. 关闭屏幕上的所有内容
  2. 使用文件资源管理器(文件、Finder、Windows 资源管理器甚至终端:)找到您的项目$ cd your/path/to/file
  3. 使用文件资源管理器重命名您的项目(确保您没有进入项目,只需找到它)。
  4. 打开安卓工作室。
  5. 导入重命名的项目。

After this, Android Studio will automatically build all the required files.

在此之后,Android Studio 将自动构建所有需要的文件。