在Android Studio中重命名模块? [英] Renaming modules in Android Studio?

查看:533
本文介绍了在Android Studio中重命名模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我选择了导入到Android Studio Gradle项目中的特定模块的错误名称。



在这张脸上,我想重命名模块 Facebook1 Facebook



在Gradle项目中这是可能的,以及如何做到这一点?

解决方案

< h2> Android Studio> = 1.4.1


  1. 右键单击模块 - >重构 - >重命名。
  2. 输入模块的新名称,然后单击确定。



旧版Android Studio



以下工作适用于我,在Android Studio(AS)1.1& 1.0.2,直接导入项目后。



在'Android'树视图(ATV)下,


  1. 右键单击模块名称: app ,Refactor - > Rename(to myApp ,点击确定)

  2. 打开 settings.gradle

  3. 更改' :app'':myApp',并保存

  4. 系统会提示您'立即同步',做到这一点(提示符是文件上方的蓝色链接)



    您的项目将从ATV消失,但不用担心,只需退出AS

  5. 从文件管理器(Android Studio之外)打开您的项目根目录,然后重命名文件夹 app myApp

  6. 重新打开AS中的项目,你会看到你的模块和Gradle脚本重新出现在ATV下! :)

恭喜,您的模块现在已被重命名! (喝茶的时间)

I picked the wrong name of a specific module which I imported to the Gradle project in Android Studio.

In this face I want to rename module Facebook1 to Facebook.

Is this possible in Gradle project and how to do it?

解决方案

Android Studio >= 1.4.1

  1. Right click the module -> Refactor -> Rename.
  2. Enter the new name of the module, click OK.

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.

Under the 'Android' tree view (ATV),

  1. Right click the module name: app, Refactor -> Rename (to myApp, click ok)
  2. Open settings.gradle
  3. Change ':app' to ':myApp', and save
  4. You will be prompted to 'Sync Now', do it (the prompt is a blue link above the file)

    (Your project will disappear from ATV, but don't worry, just exit AS)

  5. From a file manager (outside of Android Studio), open your project root directory, and rename the folder app to myApp
  6. 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屋!

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