Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
749 views
in Technique[技术] by (71.8m points)

gradle - Renaming modules in Android Studio?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...