关于在 Android Studio 中重命名 Android 项目的建议(基于 Gradle) [英] Advise on renaming a Android project in Android studio(Gradle based)

查看:36
本文介绍了关于在 Android Studio 中重命名 Android 项目的建议(基于 Gradle)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我目前的项目中,我想将Android studio (0.8.9) 中的Android 项目重命名,并希望在以后使用它.我知道论坛中讨论的 2 个解决方案.有人可以确认最好的方法和无忧无虑的.此外,任何在 Android Studio 0.8.9 上尝试/测试过的建议都是最好的.

In my present project , I wish to rename the Android project in Android studio (0.8.9) and wish to use it hereafter. I know about 2 solutions discussed in forum. Could some one please confirm best approach and hassle free. Moreover any advice tried/tested on Android studio 0.8.9 is best.

我知道的解决方案(但不确定)A.- 关闭正在考虑的项目.复制它并重命名为新名称并使用 Android Studio 打开.
在这种情况下 - 项目 .iml 文件仍然显示旧名称,.idea"文件夹下的 .name 文件也是如此.我也收到此错误:

Solutions I know about (but not sure) A.- Close the project under consideration.Copy it and rename to new name and open with Android studio.
In this case - The project .iml file still shows the old name and so does the .name file under ".idea" folder. I also get this error:

检测到不支持的模块:以下模块不支持编译:.不幸的是,您不能在一个项目中包含非 Gradle Java 模块和 Android-Gradle 模块.

B.使用 F6 选项,但它不复制.我认为它移动了整个项目,这不是解决方案.

B. Using F6 option ,but it does not copy. I think it moves the entire project, which is not the solution.

推荐答案

重命名项目时以下对我有用:

The following works for me when renaming the project:

  • 关闭 Android Studio
  • 删除项目根目录中的 *.iml 文件
  • 删除 .idea 目录中除 workspace.xml 和 tasks.xml 之外的所有内容.
  • 将项目的根目录重命名为新的项目名称
  • 重启 Android Studio 并从重命名的目录中导入项目.

注意:如果您不关心丢失工作区设置(窗口大小等)并且您没有任何任务,那么您可以完全删除 .idea 目录.

Note: If you don't care about losing your workspace settings (window sizes, etc.) and you don't have any tasks then you can just delete the .idea directory entirely.

这篇关于关于在 Android Studio 中重命名 Android 项目的建议(基于 Gradle)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆