在 Android Studio 中重命名模块? [英] Renaming modules in Android Studio?
问题描述
我选择了错误的特定模块名称,我将其导入到 Android Studio 中的 Gradle 项目中.
I picked the wrong name of a specific module which I imported to the Gradle project in Android Studio.
在这张脸中,我想将模块Facebook1
重命名为Facebook
.
In this face I want to rename module Facebook1
to Facebook
.
这在 Gradle 项目中是否可行以及如何实现?
Is this possible in Gradle project and how to do it?
推荐答案
Android Studio >= 1.4.1
- 右键单击模块 ->重构 ->重命名.
- 输入模块的新名称,点击确定.
旧版本的 Android Studio
以下对我有用,在 Android Studio (AS) 1.1 & 中测试过1.0.2,直接导入项目后.
Older versions of Android Studio
The following worked for me, tested in Android Studio (AS) 1.1 & 1.0.2, directly after importing a project.
在Android"树形视图 (ATV) 下,
Under the 'Android' tree view (ATV),
右键单击模块名称:
app
,重构 ->重命名(到myApp
,点击确定)
Right click the module name:
app
, Refactor -> Rename (tomyApp
, click ok)
打开settings.gradle
将':app'
改为':myApp'
,并保存
系统会提示您立即同步",请执行(提示是文件上方的蓝色链接)
You will be prompted to 'Sync Now', do it (the prompt is a blue link above the file)
(您的项目将从 ATV 中消失,但别担心,退出 AS)
从文件管理器(Android Studio 外部)打开您的项目根目录,并将文件夹 app
重命名为 myApp
From a file manager (outside of Android Studio), open your project root directory, and rename the folder app
to myApp
在 AS 中重新打开您的项目,您将看到您的模块和 Gradle 脚本重新出现在 ATV 下!:)
Re-open your project in AS, and you will see your module and Gradle scripts re-appear under ATV! :)
恭喜 - 您的模块现已重命名!(哇,该喝茶了)
Congratulations - your module has now been renamed! (whew, time for some tea)
这篇关于在 Android Studio 中重命名模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!